diff options
Diffstat (limited to 'drivers/acpi/utilities/utcopy.c')
| -rw-r--r-- | drivers/acpi/utilities/utcopy.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index df2d32096b72..5e1a80d1bc36 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c | |||
| @@ -109,7 +109,7 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, | |||
| 109 | { | 109 | { |
| 110 | acpi_status status = AE_OK; | 110 | acpi_status status = AE_OK; |
| 111 | 111 | ||
| 112 | ACPI_FUNCTION_TRACE("ut_copy_isimple_to_esimple"); | 112 | ACPI_FUNCTION_TRACE(ut_copy_isimple_to_esimple); |
| 113 | 113 | ||
| 114 | *buffer_space_used = 0; | 114 | *buffer_space_used = 0; |
| 115 | 115 | ||
| @@ -325,7 +325,7 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, | |||
| 325 | acpi_status status; | 325 | acpi_status status; |
| 326 | struct acpi_pkg_info info; | 326 | struct acpi_pkg_info info; |
| 327 | 327 | ||
| 328 | ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_epackage"); | 328 | ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_epackage); |
| 329 | 329 | ||
| 330 | /* | 330 | /* |
| 331 | * First package at head of the buffer | 331 | * First package at head of the buffer |
| @@ -383,7 +383,7 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object, | |||
| 383 | { | 383 | { |
| 384 | acpi_status status; | 384 | acpi_status status; |
| 385 | 385 | ||
| 386 | ACPI_FUNCTION_TRACE("ut_copy_iobject_to_eobject"); | 386 | ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject); |
| 387 | 387 | ||
| 388 | if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { | 388 | if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { |
| 389 | /* | 389 | /* |
| @@ -442,7 +442,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
| 442 | { | 442 | { |
| 443 | union acpi_operand_object *internal_object; | 443 | union acpi_operand_object *internal_object; |
| 444 | 444 | ||
| 445 | ACPI_FUNCTION_TRACE("ut_copy_esimple_to_isimple"); | 445 | ACPI_FUNCTION_TRACE(ut_copy_esimple_to_isimple); |
| 446 | 446 | ||
| 447 | /* | 447 | /* |
| 448 | * Simple types supported are: String, Buffer, Integer | 448 | * Simple types supported are: String, Buffer, Integer |
| @@ -472,8 +472,8 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
| 472 | case ACPI_TYPE_STRING: | 472 | case ACPI_TYPE_STRING: |
| 473 | 473 | ||
| 474 | internal_object->string.pointer = | 474 | internal_object->string.pointer = |
| 475 | ACPI_MEM_CALLOCATE((acpi_size) external_object->string. | 475 | ACPI_ALLOCATE_ZEROED((acpi_size) external_object->string. |
| 476 | length + 1); | 476 | length + 1); |
| 477 | if (!internal_object->string.pointer) { | 477 | if (!internal_object->string.pointer) { |
| 478 | goto error_exit; | 478 | goto error_exit; |
| 479 | } | 479 | } |
| @@ -488,7 +488,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
| 488 | case ACPI_TYPE_BUFFER: | 488 | case ACPI_TYPE_BUFFER: |
| 489 | 489 | ||
| 490 | internal_object->buffer.pointer = | 490 | internal_object->buffer.pointer = |
| 491 | ACPI_MEM_CALLOCATE(external_object->buffer.length); | 491 | ACPI_ALLOCATE_ZEROED(external_object->buffer.length); |
| 492 | if (!internal_object->buffer.pointer) { | 492 | if (!internal_object->buffer.pointer) { |
| 493 | goto error_exit; | 493 | goto error_exit; |
| 494 | } | 494 | } |
| @@ -552,7 +552,7 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object, | |||
| 552 | union acpi_operand_object *this_internal_obj; | 552 | union acpi_operand_object *this_internal_obj; |
| 553 | union acpi_object *this_external_obj; | 553 | union acpi_object *this_external_obj; |
| 554 | 554 | ||
| 555 | ACPI_FUNCTION_TRACE("ut_copy_epackage_to_ipackage"); | 555 | ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); |
| 556 | 556 | ||
| 557 | /* | 557 | /* |
| 558 | * First package at head of the buffer | 558 | * First package at head of the buffer |
| @@ -600,7 +600,7 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, | |||
| 600 | { | 600 | { |
| 601 | acpi_status status; | 601 | acpi_status status; |
| 602 | 602 | ||
| 603 | ACPI_FUNCTION_TRACE("ut_copy_eobject_to_iobject"); | 603 | ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject); |
| 604 | 604 | ||
| 605 | if (external_object->type == ACPI_TYPE_PACKAGE) { | 605 | if (external_object->type == ACPI_TYPE_PACKAGE) { |
| 606 | /* | 606 | /* |
| @@ -676,7 +676,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
| 676 | if ((source_desc->buffer.pointer) && | 676 | if ((source_desc->buffer.pointer) && |
| 677 | (source_desc->buffer.length)) { | 677 | (source_desc->buffer.length)) { |
| 678 | dest_desc->buffer.pointer = | 678 | dest_desc->buffer.pointer = |
| 679 | ACPI_MEM_ALLOCATE(source_desc->buffer.length); | 679 | ACPI_ALLOCATE(source_desc->buffer.length); |
| 680 | if (!dest_desc->buffer.pointer) { | 680 | if (!dest_desc->buffer.pointer) { |
| 681 | return (AE_NO_MEMORY); | 681 | return (AE_NO_MEMORY); |
| 682 | } | 682 | } |
| @@ -697,8 +697,8 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
| 697 | */ | 697 | */ |
| 698 | if (source_desc->string.pointer) { | 698 | if (source_desc->string.pointer) { |
| 699 | dest_desc->string.pointer = | 699 | dest_desc->string.pointer = |
| 700 | ACPI_MEM_ALLOCATE((acpi_size) source_desc->string. | 700 | ACPI_ALLOCATE((acpi_size) source_desc->string. |
| 701 | length + 1); | 701 | length + 1); |
| 702 | if (!dest_desc->string.pointer) { | 702 | if (!dest_desc->string.pointer) { |
| 703 | return (AE_NO_MEMORY); | 703 | return (AE_NO_MEMORY); |
| 704 | } | 704 | } |
| @@ -805,9 +805,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type, | |||
| 805 | /* | 805 | /* |
| 806 | * Create the object array | 806 | * Create the object array |
| 807 | */ | 807 | */ |
| 808 | target_object->package.elements = | 808 | target_object->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.count + 1) * sizeof(void *)); |
| 809 | ACPI_MEM_CALLOCATE(((acpi_size) source_object->package. | ||
| 810 | count + 1) * sizeof(void *)); | ||
| 811 | if (!target_object->package.elements) { | 809 | if (!target_object->package.elements) { |
| 812 | status = AE_NO_MEMORY; | 810 | status = AE_NO_MEMORY; |
| 813 | goto error_exit; | 811 | goto error_exit; |
| @@ -856,7 +854,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
| 856 | { | 854 | { |
| 857 | acpi_status status = AE_OK; | 855 | acpi_status status = AE_OK; |
| 858 | 856 | ||
| 859 | ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_ipackage"); | 857 | ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage); |
| 860 | 858 | ||
| 861 | dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); | 859 | dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); |
| 862 | dest_obj->common.flags = source_obj->common.flags; | 860 | dest_obj->common.flags = source_obj->common.flags; |
| @@ -865,10 +863,10 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
| 865 | /* | 863 | /* |
| 866 | * Create the object array and walk the source package tree | 864 | * Create the object array and walk the source package tree |
| 867 | */ | 865 | */ |
| 868 | dest_obj->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) | 866 | dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) |
| 869 | source_obj->package. | 867 | source_obj->package. |
| 870 | count + | 868 | count + |
| 871 | 1) * sizeof(void *)); | 869 | 1) * sizeof(void *)); |
| 872 | if (!dest_obj->package.elements) { | 870 | if (!dest_obj->package.elements) { |
| 873 | ACPI_ERROR((AE_INFO, "Package allocation failure")); | 871 | ACPI_ERROR((AE_INFO, "Package allocation failure")); |
| 874 | return_ACPI_STATUS(AE_NO_MEMORY); | 872 | return_ACPI_STATUS(AE_NO_MEMORY); |
| @@ -882,6 +880,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
| 882 | acpi_ut_copy_ielement_to_ielement, | 880 | acpi_ut_copy_ielement_to_ielement, |
| 883 | walk_state); | 881 | walk_state); |
| 884 | if (ACPI_FAILURE(status)) { | 882 | if (ACPI_FAILURE(status)) { |
| 883 | |||
| 885 | /* On failure, delete the destination package object */ | 884 | /* On failure, delete the destination package object */ |
| 886 | 885 | ||
| 887 | acpi_ut_remove_reference(dest_obj); | 886 | acpi_ut_remove_reference(dest_obj); |
| @@ -911,7 +910,7 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, | |||
| 911 | { | 910 | { |
| 912 | acpi_status status = AE_OK; | 911 | acpi_status status = AE_OK; |
| 913 | 912 | ||
| 914 | ACPI_FUNCTION_TRACE("ut_copy_iobject_to_iobject"); | 913 | ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject); |
| 915 | 914 | ||
| 916 | /* Create the top level object */ | 915 | /* Create the top level object */ |
| 917 | 916 | ||
