aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/acpica/nspredef.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 7f8e066b12a3..abbb855e1b9a 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -1046,22 +1046,25 @@ acpi_ns_repair_object(u32 expected_btypes,
1046 ACPI_MEMCPY(new_object->string.pointer, 1046 ACPI_MEMCPY(new_object->string.pointer,
1047 return_object->buffer.pointer, length); 1047 return_object->buffer.pointer, length);
1048 1048
1049 /* Install the new return object */
1050
1051 acpi_ut_remove_reference(return_object);
1052 *return_object_ptr = new_object;
1053
1054 /* 1049 /*
1055 * If the object is a package element, we need to: 1050 * If the original object is a package element, we need to:
1056 * 1. Decrement the reference count of the orignal object, it was 1051 * 1. Set the reference count of the new object to match the
1057 * incremented when building the package 1052 * reference count of the old object.
1058 * 2. Increment the reference count of the new object, it will be 1053 * 2. Decrement the reference count of the original object.
1059 * decremented when releasing the package
1060 */ 1054 */
1061 if (package_index != ACPI_NOT_PACKAGE) { 1055 if (package_index != ACPI_NOT_PACKAGE) {
1062 acpi_ut_remove_reference(return_object); 1056 new_object->common.reference_count =
1063 acpi_ut_add_reference(new_object); 1057 return_object->common.reference_count;
1058
1059 if (return_object->common.reference_count > 1) {
1060 return_object->common.reference_count--;
1061 }
1064 } 1062 }
1063
1064 /* Delete old object, install the new return object */
1065
1066 acpi_ut_remove_reference(return_object);
1067 *return_object_ptr = new_object;
1065 return (AE_OK); 1068 return (AE_OK);
1066 1069
1067 default: 1070 default: