aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r--drivers/acpi/utils.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 6b516852ac1..ce093d4516b 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -62,26 +62,25 @@ acpi_extract_package(union acpi_object *package,
62 62
63 if (!package || (package->type != ACPI_TYPE_PACKAGE) 63 if (!package || (package->type != ACPI_TYPE_PACKAGE)
64 || (package->package.count < 1)) { 64 || (package->package.count < 1)) {
65 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 65 ACPI_WARNING((AE_INFO, "Invalid package argument"));
66 "Invalid 'package' argument\n"));
67 return_ACPI_STATUS(AE_BAD_PARAMETER); 66 return_ACPI_STATUS(AE_BAD_PARAMETER);
68 } 67 }
69 68
70 if (!format || !format->pointer || (format->length < 1)) { 69 if (!format || !format->pointer || (format->length < 1)) {
71 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'format' argument\n")); 70 ACPI_WARNING((AE_INFO, "Invalid format argument"));
72 return_ACPI_STATUS(AE_BAD_PARAMETER); 71 return_ACPI_STATUS(AE_BAD_PARAMETER);
73 } 72 }
74 73
75 if (!buffer) { 74 if (!buffer) {
76 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'buffer' argument\n")); 75 ACPI_WARNING((AE_INFO, "Invalid buffer argument"));
77 return_ACPI_STATUS(AE_BAD_PARAMETER); 76 return_ACPI_STATUS(AE_BAD_PARAMETER);
78 } 77 }
79 78
80 format_count = (format->length / sizeof(char)) - 1; 79 format_count = (format->length / sizeof(char)) - 1;
81 if (format_count > package->package.count) { 80 if (format_count > package->package.count) {
82 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 81 ACPI_WARNING((AE_INFO, "Format specifies more objects [%d]"
83 "Format specifies more objects [%d] than exist in package [%d].", 82 " than exist in package [%d].",
84 format_count, package->package.count)); 83 format_count, package->package.count));
85 return_ACPI_STATUS(AE_BAD_DATA); 84 return_ACPI_STATUS(AE_BAD_DATA);
86 } 85 }
87 86
@@ -113,9 +112,10 @@ acpi_extract_package(union acpi_object *package,
113 tail_offset += sizeof(char *); 112 tail_offset += sizeof(char *);
114 break; 113 break;
115 default: 114 default:
116 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 115 ACPI_WARNING((AE_INFO, "Invalid package element"
117 "Invalid package element [%d]: got number, expecing [%c].\n", 116 " [%d]: got number, expecing"
118 i, format_string[i])); 117 " [%c]",
118 i, format_string[i]));
119 return_ACPI_STATUS(AE_BAD_DATA); 119 return_ACPI_STATUS(AE_BAD_DATA);
120 break; 120 break;
121 } 121 }
@@ -138,9 +138,10 @@ acpi_extract_package(union acpi_object *package,
138 tail_offset += sizeof(u8 *); 138 tail_offset += sizeof(u8 *);
139 break; 139 break;
140 default: 140 default:
141 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 141 ACPI_WARNING((AE_INFO, "Invalid package element"
142 "Invalid package element [%d] got string/buffer, expecing [%c].\n", 142 " [%d] got string/buffer,"
143 i, format_string[i])); 143 " expecing [%c]",
144 i, format_string[i]));
144 return_ACPI_STATUS(AE_BAD_DATA); 145 return_ACPI_STATUS(AE_BAD_DATA);
145 break; 146 break;
146 } 147 }
@@ -325,7 +326,7 @@ acpi_evaluate_string(acpi_handle handle,
325 326
326 *data = kmalloc(element->string.length + 1, GFP_KERNEL); 327 *data = kmalloc(element->string.length + 1, GFP_KERNEL);
327 if (!data) { 328 if (!data) {
328 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Memory allocation error\n")); 329 ACPI_ERROR((AE_INFO, "Memory allocation"));
329 return_VALUE(-ENOMEM); 330 return_VALUE(-ENOMEM);
330 } 331 }
331 memset(*data, 0, element->string.length + 1); 332 memset(*data, 0, element->string.length + 1);
@@ -367,25 +368,22 @@ acpi_evaluate_reference(acpi_handle handle,
367 package = (union acpi_object *)buffer.pointer; 368 package = (union acpi_object *)buffer.pointer;
368 369
369 if ((buffer.length == 0) || !package) { 370 if ((buffer.length == 0) || !package) {
370 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 371 ACPI_ERROR((AE_INFO, "No return object (len %X ptr %p)",
371 "No return object (len %X ptr %p)\n", 372 (unsigned)buffer.length, package));
372 (unsigned)buffer.length, package));
373 status = AE_BAD_DATA; 373 status = AE_BAD_DATA;
374 acpi_util_eval_error(handle, pathname, status); 374 acpi_util_eval_error(handle, pathname, status);
375 goto end; 375 goto end;
376 } 376 }
377 if (package->type != ACPI_TYPE_PACKAGE) { 377 if (package->type != ACPI_TYPE_PACKAGE) {
378 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 378 ACPI_ERROR((AE_INFO, "Expecting a [Package], found type %X",
379 "Expecting a [Package], found type %X\n", 379 package->type));
380 package->type));
381 status = AE_BAD_DATA; 380 status = AE_BAD_DATA;
382 acpi_util_eval_error(handle, pathname, status); 381 acpi_util_eval_error(handle, pathname, status);
383 goto end; 382 goto end;
384 } 383 }
385 if (!package->package.count) { 384 if (!package->package.count) {
386 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 385 ACPI_ERROR((AE_INFO, "[Package] has zero elements (%p)",
387 "[Package] has zero elements (%p)\n", 386 package));
388 package));
389 status = AE_BAD_DATA; 387 status = AE_BAD_DATA;
390 acpi_util_eval_error(handle, pathname, status); 388 acpi_util_eval_error(handle, pathname, status);
391 goto end; 389 goto end;
@@ -404,9 +402,9 @@ acpi_evaluate_reference(acpi_handle handle,
404 402
405 if (element->type != ACPI_TYPE_ANY) { 403 if (element->type != ACPI_TYPE_ANY) {
406 status = AE_BAD_DATA; 404 status = AE_BAD_DATA;
407 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 405 ACPI_ERROR((AE_INFO,
408 "Expecting a [Reference] package element, found type %X\n", 406 "Expecting a [Reference] package element, found type %X",
409 element->type)); 407 element->type));
410 acpi_util_eval_error(handle, pathname, status); 408 acpi_util_eval_error(handle, pathname, status);
411 break; 409 break;
412 } 410 }