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>
This commit is contained in:

committed by
Rafael J. Wysocki

parent
70f6c08757
commit
2d0acb4af9
@@ -1219,10 +1219,9 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
|
|||||||
{
|
{
|
||||||
struct semaphore *sem = NULL;
|
struct semaphore *sem = NULL;
|
||||||
|
|
||||||
sem = acpi_os_allocate(sizeof(struct semaphore));
|
sem = acpi_os_allocate_zeroed(sizeof(struct semaphore));
|
||||||
if (!sem)
|
if (!sem)
|
||||||
return AE_NO_MEMORY;
|
return AE_NO_MEMORY;
|
||||||
memset(sem, 0, sizeof(struct semaphore));
|
|
||||||
|
|
||||||
sema_init(sem, initial_units);
|
sema_init(sem, initial_units);
|
||||||
|
|
||||||
|
@@ -164,11 +164,10 @@ acpi_extract_package(union acpi_object *package,
|
|||||||
* Validate output buffer.
|
* Validate output buffer.
|
||||||
*/
|
*/
|
||||||
if (buffer->length == ACPI_ALLOCATE_BUFFER) {
|
if (buffer->length == ACPI_ALLOCATE_BUFFER) {
|
||||||
buffer->pointer = ACPI_ALLOCATE(size_required);
|
buffer->pointer = ACPI_ALLOCATE_ZEROED(size_required);
|
||||||
if (!buffer->pointer)
|
if (!buffer->pointer)
|
||||||
return AE_NO_MEMORY;
|
return AE_NO_MEMORY;
|
||||||
buffer->length = size_required;
|
buffer->length = size_required;
|
||||||
memset(buffer->pointer, 0, size_required);
|
|
||||||
} else {
|
} else {
|
||||||
if (buffer->length < size_required) {
|
if (buffer->length < size_required) {
|
||||||
buffer->length = size_required;
|
buffer->length = size_required;
|
||||||
|
Reference in New Issue
Block a user