X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Facpi%2Futils.c;h=68a809fa7b19d06ef9f9457120d05fdbbecdb9b2;hb=9af9fc45ddd3e315c51f87392b5048967e4343cd;hp=1930e1a75b22589838d46b8cb66779f131d0a069;hpb=a8c4c20dfa8b28a3c99e33c639d9c2ea5657741e;p=linux-2.6 diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 1930e1a75b..68a809fa7b 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -83,7 +83,7 @@ acpi_extract_package(union acpi_object *package, return AE_BAD_DATA; } - format_string = (char *)format->pointer; + format_string = format->pointer; /* * Calculate size_required. @@ -262,11 +262,10 @@ acpi_evaluate_integer(acpi_handle handle, if (!data) return AE_BAD_PARAMETER; - element = kmalloc(sizeof(union acpi_object), GFP_KERNEL); + element = kzalloc(sizeof(union acpi_object), irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); if (!element) return AE_NO_MEMORY; - memset(element, 0, sizeof(union acpi_object)); buffer.length = sizeof(union acpi_object); buffer.pointer = element; status = acpi_evaluate_object(handle, pathname, arguments, &buffer); @@ -321,18 +320,17 @@ acpi_evaluate_string(acpi_handle handle, return AE_BAD_DATA; } - *data = kmalloc(element->string.length + 1, GFP_KERNEL); + *data = kzalloc(element->string.length + 1, GFP_KERNEL); if (!data) { printk(KERN_ERR PREFIX "Memory allocation\n"); return -ENOMEM; } - memset(*data, 0, element->string.length + 1); memcpy(*data, element->string.pointer, element->string.length); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%s]\n", *data)); - acpi_os_free(buffer.pointer); + kfree(buffer.pointer); return AE_OK; } @@ -361,7 +359,7 @@ acpi_evaluate_reference(acpi_handle handle, if (ACPI_FAILURE(status)) goto end; - package = (union acpi_object *)buffer.pointer; + package = buffer.pointer; if ((buffer.length == 0) || !package) { printk(KERN_ERR PREFIX "No return object (len %X ptr %p)\n", @@ -418,7 +416,7 @@ acpi_evaluate_reference(acpi_handle handle, //kfree(list->handles); } - acpi_os_free(buffer.pointer); + kfree(buffer.pointer); return status; }