diff options
Diffstat (limited to 'drivers/acpi/acpica/nsxfeval.c')
-rw-r--r-- | drivers/acpi/acpica/nsxfeval.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c index e973e311f856..1f0c28ba50df 100644 --- a/drivers/acpi/acpica/nsxfeval.c +++ b/drivers/acpi/acpica/nsxfeval.c | |||
@@ -84,7 +84,7 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
84 | acpi_object_type return_type) | 84 | acpi_object_type return_type) |
85 | { | 85 | { |
86 | acpi_status status; | 86 | acpi_status status; |
87 | u8 must_free = FALSE; | 87 | u8 free_buffer_on_error = FALSE; |
88 | 88 | ||
89 | ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed); | 89 | ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed); |
90 | 90 | ||
@@ -95,14 +95,13 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
95 | } | 95 | } |
96 | 96 | ||
97 | if (return_buffer->length == ACPI_ALLOCATE_BUFFER) { | 97 | if (return_buffer->length == ACPI_ALLOCATE_BUFFER) { |
98 | must_free = TRUE; | 98 | free_buffer_on_error = TRUE; |
99 | } | 99 | } |
100 | 100 | ||
101 | /* Evaluate the object */ | 101 | /* Evaluate the object */ |
102 | 102 | ||
103 | status = | 103 | status = acpi_evaluate_object(handle, pathname, |
104 | acpi_evaluate_object(handle, pathname, external_params, | 104 | external_params, return_buffer); |
105 | return_buffer); | ||
106 | if (ACPI_FAILURE(status)) { | 105 | if (ACPI_FAILURE(status)) { |
107 | return_ACPI_STATUS(status); | 106 | return_ACPI_STATUS(status); |
108 | } | 107 | } |
@@ -135,11 +134,15 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
135 | pointer)->type), | 134 | pointer)->type), |
136 | acpi_ut_get_type_name(return_type))); | 135 | acpi_ut_get_type_name(return_type))); |
137 | 136 | ||
138 | if (must_free) { | 137 | if (free_buffer_on_error) { |
139 | 138 | /* | |
140 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ | 139 | * Free a buffer created via ACPI_ALLOCATE_BUFFER. |
141 | 140 | * Note: We use acpi_os_free here because acpi_os_allocate was used | |
142 | ACPI_FREE_BUFFER(*return_buffer); | 141 | * to allocate the buffer. This purposefully bypasses the |
142 | * (optionally enabled) allocation tracking mechanism since we | ||
143 | * only want to track internal allocations. | ||
144 | */ | ||
145 | acpi_os_free(return_buffer->pointer); | ||
143 | return_buffer->pointer = NULL; | 146 | return_buffer->pointer = NULL; |
144 | } | 147 | } |
145 | 148 | ||