* [PATCH] platform/x86: thinkpad_acpi: re-initialize acpi buffer size when reuse
@ 2020-09-29 8:20 Aaron Ma
2020-09-30 13:55 ` Andy Shevchenko
2020-10-02 17:09 ` [PATCH v2] platform/x86: thinkpad_acpi: re-initialize ACPI " Aaron Ma
0 siblings, 2 replies; 3+ messages in thread
From: Aaron Ma @ 2020-09-29 8:20 UTC (permalink / raw)
To: aaron.ma, mapengyu, ibm-acpi, dvhart, andy, ibm-acpi-devel,
platform-driver-x86, linux-kernel
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.
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
---
drivers/platform/x86/thinkpad_acpi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 9c4df41687a3..477d63c49c04 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -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)) {
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: thinkpad_acpi: re-initialize acpi buffer size when reuse
2020-09-29 8:20 [PATCH] platform/x86: thinkpad_acpi: re-initialize acpi buffer size when reuse Aaron Ma
@ 2020-09-30 13:55 ` Andy Shevchenko
2020-10-02 17:09 ` [PATCH v2] platform/x86: thinkpad_acpi: re-initialize ACPI " Aaron Ma
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2020-09-30 13:55 UTC (permalink / raw)
To: Aaron Ma
Cc: mapengyu, Henrique de Moraes Holschuh, Darren Hart,
Andy Shevchenko, Thinkpad-acpi devel ML, Platform Driver,
Linux Kernel Mailing List
On Tue, Sep 29, 2020 at 11:20 AM Aaron Ma <aaron.ma@canonical.com> wrote:
>
> Evaluating acpi _BCL could be failed, then acpi buffer size will be set
'could be failed' -> 'could fail'
> to 0. When reuse this acpi buffer, AE_BUFFER_OVERFLOW will be triggered.
>
> Re-initialize buffer size will make acpi evaluate successfully.
acpi -> ACPI in all cases above.
Fixes tag, please?
> Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Code is okay.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] platform/x86: thinkpad_acpi: re-initialize ACPI buffer size when reuse
2020-09-29 8:20 [PATCH] platform/x86: thinkpad_acpi: re-initialize acpi buffer size when reuse Aaron Ma
2020-09-30 13:55 ` Andy Shevchenko
@ 2020-10-02 17:09 ` Aaron Ma
1 sibling, 0 replies; 3+ messages in thread
From: Aaron Ma @ 2020-10-02 17:09 UTC (permalink / raw)
To: aaron.ma, mapengyu, ibm-acpi, dvhart, andy, ibm-acpi-devel,
platform-driver-x86, linux-kernel
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>
---
drivers/platform/x86/thinkpad_acpi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 9c4df41687a3..477d63c49c04 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -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)) {
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-02 17:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29 8:20 [PATCH] platform/x86: thinkpad_acpi: re-initialize acpi buffer size when reuse Aaron Ma
2020-09-30 13:55 ` Andy Shevchenko
2020-10-02 17:09 ` [PATCH v2] platform/x86: thinkpad_acpi: re-initialize ACPI " Aaron Ma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).