diff options
author | jhbird.choi@samsung.com <jhbird.choi@samsung.com> | 2014-03-20 03:35:56 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-04-04 10:23:33 -0400 |
commit | 2d0acb4af981e20eb626c6ea1925e95056220b2a (patch) | |
tree | d8dfa9464f7c03d02eaea362d0cd858e10882e97 /drivers/acpi | |
parent | 70f6c087573eeb406252ff8d98f511eb5f71496e (diff) |
ACPI: Clean up memory allocations
Use acpi_os_allocate_zeroed instead of acpi_os_allocate + memset.
Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/osl.c | 3 | ||||
-rw-r--r-- | drivers/acpi/utils.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index f7fd72ac69cf..6776c599816f 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) | |||
1219 | { | 1219 | { |
1220 | struct semaphore *sem = NULL; | 1220 | struct semaphore *sem = NULL; |
1221 | 1221 | ||
1222 | sem = acpi_os_allocate(sizeof(struct semaphore)); | 1222 | sem = acpi_os_allocate_zeroed(sizeof(struct semaphore)); |
1223 | if (!sem) | 1223 | if (!sem) |
1224 | return AE_NO_MEMORY; | 1224 | return AE_NO_MEMORY; |
1225 | memset(sem, 0, sizeof(struct semaphore)); | ||
1226 | 1225 | ||
1227 | sema_init(sem, initial_units); | 1226 | sema_init(sem, initial_units); |
1228 | 1227 | ||
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 0f5f78fa6545..bba526148583 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -164,11 +164,10 @@ acpi_extract_package(union acpi_object *package, | |||
164 | * Validate output buffer. | 164 | * Validate output buffer. |
165 | */ | 165 | */ |
166 | if (buffer->length == ACPI_ALLOCATE_BUFFER) { | 166 | if (buffer->length == ACPI_ALLOCATE_BUFFER) { |
167 | buffer->pointer = ACPI_ALLOCATE(size_required); | 167 | buffer->pointer = ACPI_ALLOCATE_ZEROED(size_required); |
168 | if (!buffer->pointer) | 168 | if (!buffer->pointer) |
169 | return AE_NO_MEMORY; | 169 | return AE_NO_MEMORY; |
170 | buffer->length = size_required; | 170 | buffer->length = size_required; |
171 | memset(buffer->pointer, 0, size_required); | ||
172 | } else { | 171 | } else { |
173 | if (buffer->length < size_required) { | 172 | if (buffer->length < size_required) { |
174 | buffer->length = size_required; | 173 | buffer->length = size_required; |