aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r--drivers/acpi/utils.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index e827be36ee8d..f844941089bb 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -259,34 +259,26 @@ acpi_evaluate_integer(acpi_handle handle,
259 struct acpi_object_list *arguments, unsigned long long *data) 259 struct acpi_object_list *arguments, unsigned long long *data)
260{ 260{
261 acpi_status status = AE_OK; 261 acpi_status status = AE_OK;
262 union acpi_object *element; 262 union acpi_object element;
263 struct acpi_buffer buffer = { 0, NULL }; 263 struct acpi_buffer buffer = { 0, NULL };
264 264
265
266 if (!data) 265 if (!data)
267 return AE_BAD_PARAMETER; 266 return AE_BAD_PARAMETER;
268 267
269 element = kzalloc(sizeof(union acpi_object), irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL);
270 if (!element)
271 return AE_NO_MEMORY;
272
273 buffer.length = sizeof(union acpi_object); 268 buffer.length = sizeof(union acpi_object);
274 buffer.pointer = element; 269 buffer.pointer = &element;
275 status = acpi_evaluate_object(handle, pathname, arguments, &buffer); 270 status = acpi_evaluate_object(handle, pathname, arguments, &buffer);
276 if (ACPI_FAILURE(status)) { 271 if (ACPI_FAILURE(status)) {
277 acpi_util_eval_error(handle, pathname, status); 272 acpi_util_eval_error(handle, pathname, status);
278 kfree(element);
279 return status; 273 return status;
280 } 274 }
281 275
282 if (element->type != ACPI_TYPE_INTEGER) { 276 if (element.type != ACPI_TYPE_INTEGER) {
283 acpi_util_eval_error(handle, pathname, AE_BAD_DATA); 277 acpi_util_eval_error(handle, pathname, AE_BAD_DATA);
284 kfree(element);
285 return AE_BAD_DATA; 278 return AE_BAD_DATA;
286 } 279 }
287 280
288 *data = element->integer.value; 281 *data = element.integer.value;
289 kfree(element);
290 282
291 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%llu]\n", *data)); 283 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%llu]\n", *data));
292 284