summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ma <aaron.ma@canonical.com>2020-10-02 20:09:16 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-14 10:48:15 +0300
commitc25dcb0c07a7e090fd9da5333cc5de024dd7d23f (patch)
tree1d2bc9b0db625a679fbf65df5ef194b1ea25662a
parent1323ff9dde1b9ff65401913dfb82d1ed1285f201 (diff)
downloadlinux-c25dcb0c07a7e090fd9da5333cc5de024dd7d23f.tar.xz
platform/x86: thinkpad_acpi: re-initialize ACPI buffer size when reuse
commit 720ef73d1a239e33c3ad8fac356b9b1348e68aaf upstream. Evaluating ACPI _BCL could fail, then ACPI buffer size will be set to 0. When reuse this ACPI buffer, AE_BUFFER_OVERFLOW will be triggered. Re-initialize buffer size will make ACPI evaluate successfully. Fixes: 46445b6b896fd ("thinkpad-acpi: fix handle locate for video and query of _BCL") Signed-off-by: Aaron Ma <aaron.ma@canonical.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index fc3d42548a34..379f9633f78e 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -6640,8 +6640,10 @@ static int __init tpacpi_query_bcl_levels(acpi_handle handle)
list_for_each_entry(child, &device->children, node) {
acpi_status status = acpi_evaluate_object(child->handle, "_BCL",
NULL, &buffer);
- if (ACPI_FAILURE(status))
+ if (ACPI_FAILURE(status)) {
+ buffer.length = ACPI_ALLOCATE_BUFFER;
continue;
+ }
obj = (union acpi_object *)buffer.pointer;
if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {