platform/x86: thinkpad_acpi: re-initialize acpi buffer size when reuse
PATCH 1/1 platform/x86: thinkpad_acpi: re-initialize acpi buffer size when reuse
Evaluating acpi _BCL could be failed, 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.
--- drivers/platform/x86/thinkpad_acpi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +3 -1
@@ -6829,8 +6829,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 )) {
Signature · 1 line
2.28.0
Quoted 2 lines · Aaron Ma
Evaluating acpi
_BCLcould be failed, then acpi buffer size will be set
'could be failed' -> 'could fail'
Quoted 3 lines
to 0. When reuse this acpi buffer,
AE_BUFFER_OVERFLOWwill be triggered.Re-initialize buffer size will make acpi evaluate successfully.
acpi -> ACPI in all cases above.
Fixes tag, please?
Quoted 1 line
Signed-off-by Aaron Ma <[email protected]>
Code is okay.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 1/1 platform/x86: thinkpad_acpi: re-initialize ACPI buffer size when reuse
In reply to Aaron MaEvaluating 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.
--- drivers/platform/x86/thinkpad_acpi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +3 -1
@@ -6829,8 +6829,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 )) {
Signature · 1 line
2.28.0