aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exconfig.c')
-rw-r--r--drivers/acpi/executer/exconfig.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index 734b2f24af48..8bfa6effaa0c 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -376,16 +376,22 @@ acpi_ex_load_op (
376 */ 376 */
377 status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc); 377 status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
378 if (ACPI_FAILURE (status)) { 378 if (ACPI_FAILURE (status)) {
379 goto cleanup; 379 return_ACPI_STATUS (status);
380 } 380 }
381 381
382 table_ptr = ACPI_CAST_PTR (struct acpi_table_header, 382 table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
383 buffer_desc->buffer.pointer); 383 buffer_desc->buffer.pointer);
384 384
385 /* Sanity check the table length */ 385 /* All done with the buffer_desc, delete it */
386
387 buffer_desc->buffer.pointer = NULL;
388 acpi_ut_remove_reference (buffer_desc);
389
390 /* Sanity check the table length */
386 391
387 if (table_ptr->length < sizeof (struct acpi_table_header)) { 392 if (table_ptr->length < sizeof (struct acpi_table_header)) {
388 return_ACPI_STATUS (AE_BAD_HEADER); 393 status = AE_BAD_HEADER;
394 goto cleanup;
389 } 395 }
390 break; 396 break;
391 397
@@ -413,7 +419,9 @@ acpi_ex_load_op (
413 419
414 status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle); 420 status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle);
415 if (ACPI_FAILURE (status)) { 421 if (ACPI_FAILURE (status)) {
416 goto cleanup; 422 /* On error, table_ptr was deallocated above */
423
424 return_ACPI_STATUS (status);
417 } 425 }
418 426
419 /* Store the ddb_handle into the Target operand */ 427 /* Store the ddb_handle into the Target operand */
@@ -421,17 +429,14 @@ acpi_ex_load_op (
421 status = acpi_ex_store (ddb_handle, target, walk_state); 429 status = acpi_ex_store (ddb_handle, target, walk_state);
422 if (ACPI_FAILURE (status)) { 430 if (ACPI_FAILURE (status)) {
423 (void) acpi_ex_unload_table (ddb_handle); 431 (void) acpi_ex_unload_table (ddb_handle);
424 }
425 432
426 return_ACPI_STATUS (status); 433 /* table_ptr was deallocated above */
427 434
435 return_ACPI_STATUS (status);
436 }
428 437
429cleanup: 438cleanup:
430 439 if (ACPI_FAILURE (status)) {
431 if (buffer_desc) {
432 acpi_ut_remove_reference (buffer_desc);
433 }
434 else {
435 ACPI_MEM_FREE (table_ptr); 440 ACPI_MEM_FREE (table_ptr);
436 } 441 }
437 return_ACPI_STATUS (status); 442 return_ACPI_STATUS (status);