thinkpad-acpi: acpi_evalf fixes

Use acpi_format_exception() in acpi_evalf() instead of logging numeric
errors.

Also, when ACPICA returns an error, we should not be touching the return
object, as it is invalid.  In debug mode, acpi_evalf() callers would
printk the returned crap (but fortunately, not use it).

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
This commit is contained in:
Henrique de Moraes Holschuh 2010-05-16 19:45:45 -03:00
parent 437e470c4c
commit 263f4a30e4

View File

@ -605,9 +605,10 @@ static int acpi_evalf(acpi_handle handle,
switch (res_type) { switch (res_type) {
case 'd': /* int */ case 'd': /* int */
if (res) success = (status == AE_OK &&
out_obj.type == ACPI_TYPE_INTEGER);
if (success && res)
*(int *)res = out_obj.integer.value; *(int *)res = out_obj.integer.value;
success = status == AE_OK && out_obj.type == ACPI_TYPE_INTEGER;
break; break;
case 'v': /* void */ case 'v': /* void */
success = status == AE_OK; success = status == AE_OK;
@ -620,8 +621,8 @@ static int acpi_evalf(acpi_handle handle,
} }
if (!success && !quiet) if (!success && !quiet)
printk(TPACPI_ERR "acpi_evalf(%s, %s, ...) failed: %d\n", printk(TPACPI_ERR "acpi_evalf(%s, %s, ...) failed: %s\n",
method, fmt0, status); method, fmt0, acpi_format_exception(status));
return success; return success;
} }