From 2d0acb4af981e20eb626c6ea1925e95056220b2a Mon Sep 17 00:00:00 2001 From: "jhbird.choi@samsung.com" Date: Thu, 20 Mar 2014 16:35:56 +0900 Subject: ACPI: Clean up memory allocations Use acpi_os_allocate_zeroed instead of acpi_os_allocate + memset. Signed-off-by: Jonghwan Choi [rjw: Subject and changelog] Signed-off-by: Rafael J. Wysocki --- drivers/acpi/osl.c | 3 +-- drivers/acpi/utils.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index f7fd72a..6776c59 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1219,10 +1219,9 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) { struct semaphore *sem = NULL; - sem = acpi_os_allocate(sizeof(struct semaphore)); + sem = acpi_os_allocate_zeroed(sizeof(struct semaphore)); if (!sem) return AE_NO_MEMORY; - memset(sem, 0, sizeof(struct semaphore)); sema_init(sem, initial_units); diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 0f5f78f..bba5261 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -164,11 +164,10 @@ acpi_extract_package(union acpi_object *package, * Validate output buffer. */ if (buffer->length == ACPI_ALLOCATE_BUFFER) { - buffer->pointer = ACPI_ALLOCATE(size_required); + buffer->pointer = ACPI_ALLOCATE_ZEROED(size_required); if (!buffer->pointer) return AE_NO_MEMORY; buffer->length = size_required; - memset(buffer->pointer, 0, size_required); } else { if (buffer->length < size_required) { buffer->length = size_required; -- cgit v1.1