* [PATCH] platform/x86: x86-android-tablets: fix codec teardown if poweroff handler setup fails
@ 2026-11-03 10:55 Wentao Liang
2026-11-03 11:10 ` Krzysztof Kozlowski
2026-11-03 16:28 ` Hans de Goede
0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-11-03 10:55 UTC (permalink / raw)
To: Hans de Goede, Ilpo Järvinen
Cc: platform-driver-x86, linux-kernel, Wentao Liang, stable
lenovo_yoga_tab2_830_1050_init_codec() stores the codec device reference,
the pinctrl handle and the pin mappings in globals on success; they are
only released by lenovo_yoga_tab2_830_1050_exit(). If the
register_sys_off_handler() call which follows it fails, the init callback
returns an error before the exit callback has been registered with the
framework, so the codec device reference and the other resources are
never released.
Factor the codec teardown out into a helper and call it from the error
path of both init callbacks.
Fixes: 4ce8f4c2027d ("platform/x86: x86-android-tablets: Fix Lenovo Yoga Tablet 2 830/1050 poweroff again")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
.../platform/x86/x86-android-tablets/lenovo.c | 27 +++++++++++++------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index 52d96ae89078..294986f84ce8 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -548,6 +548,14 @@ static int __init lenovo_yoga_tab2_830_1050_init_codec(void)
return ret;
}
+static void lenovo_yoga_tab2_830_1050_exit_codec(void)
+{
+ device_remove_software_node(lenovo_yoga_tab2_830_1050_codec_dev);
+ pinctrl_put(lenovo_yoga_tab2_830_1050_codec_pinctrl);
+ pinctrl_unregister_mappings(&lenovo_yoga_tab2_830_1050_codec_pinctrl_map);
+ put_device(lenovo_yoga_tab2_830_1050_codec_dev);
+}
+
/*
* These tablet's DSDT does not set acpi_gbl_reduced_hardware, so acpi_power_off()
* gets used as pm_power_off handler. This causes "poweroff" on these tablets
@@ -578,8 +586,11 @@ static int __init lenovo_yoga_tab2_830_1050_init(struct device *dev)
lenovo_yoga_tab2_830_1050_sys_off_handler =
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_FIRMWARE + 1,
lenovo_yoga_tab2_830_1050_power_off, NULL);
- if (IS_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler))
- return PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
+ if (IS_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler)) {
+ ret = PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
+ lenovo_yoga_tab2_830_1050_exit_codec();
+ return ret;
+ }
return 0;
}
@@ -588,10 +599,7 @@ static void lenovo_yoga_tab2_830_1050_exit(void)
{
unregister_sys_off_handler(lenovo_yoga_tab2_830_1050_sys_off_handler);
- device_remove_software_node(lenovo_yoga_tab2_830_1050_codec_dev);
- pinctrl_put(lenovo_yoga_tab2_830_1050_codec_pinctrl);
- pinctrl_unregister_mappings(&lenovo_yoga_tab2_830_1050_codec_pinctrl_map);
- put_device(lenovo_yoga_tab2_830_1050_codec_dev);
+ lenovo_yoga_tab2_830_1050_exit_codec();
}
/*
@@ -776,8 +784,11 @@ static int __init lenovo_yoga_tab2_1380_init(struct device *dev)
lenovo_yoga_tab2_830_1050_sys_off_handler =
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_FIRMWARE + 1,
lenovo_yoga_tab2_830_1050_power_off, NULL);
- if (IS_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler))
- return PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
+ if (IS_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler)) {
+ ret = PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
+ lenovo_yoga_tab2_830_1050_exit_codec();
+ return ret;
+ }
return 0;
}
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: x86-android-tablets: fix codec teardown if poweroff handler setup fails
2026-11-03 10:55 [PATCH] platform/x86: x86-android-tablets: fix codec teardown if poweroff handler setup fails Wentao Liang
@ 2026-11-03 11:10 ` Krzysztof Kozlowski
2026-11-03 16:28 ` Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-03 11:10 UTC (permalink / raw)
To: Wentao Liang
Cc: stable, Hans de Goede, Ilpo Järvinen, platform-driver-x86,
linux-kernel
On Tue, 03 Nov 2026 10:55:44 +0000, Wentao Liang wrote:
> lenovo_yoga_tab2_830_1050_init_codec() stores the codec device reference,
> the pinctrl handle and the pin mappings in globals on success; they are
> only released by lenovo_yoga_tab2_830_1050_exit(). If the
> register_sys_off_handler() call which follows it fails, the init callback
> returns an error before the exit callback has been registered with the
> framework, so the codec device reference and the other resources are
> never released.
>
> Factor the codec teardown out into a helper and call it from the error
> path of both init callbacks.
>
> Fixes: 4ce8f4c2027d ("platform/x86: x86-android-tablets: Fix Lenovo Yoga Tablet 2 830/1050 poweroff again")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> .../platform/x86/x86-android-tablets/lenovo.c | 27 +++++++++++++------
> 1 file changed, 19 insertions(+), 8 deletions(-)
>
Multiple things here:
1. Your team ignored completely previous feedback. Multiple times.
2. You use multiple identities with this email address, thus I doubt that we
speak with an actual person.
3. Your bot does not even bother running checkpatch, right?
4. Nothing of this was reproduced nor tested.
5. Finally, the same feedback:
You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.
More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.
This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down. Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.
Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem (so a patchset grouping multiple patches with a short cover
letter), how to document the issue discovery method and what was
or was not tested.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: x86-android-tablets: fix codec teardown if poweroff handler setup fails
2026-11-03 10:55 [PATCH] platform/x86: x86-android-tablets: fix codec teardown if poweroff handler setup fails Wentao Liang
2026-11-03 11:10 ` Krzysztof Kozlowski
@ 2026-11-03 16:28 ` Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2026-11-03 16:28 UTC (permalink / raw)
To: Wentao Liang, Ilpo Järvinen
Cc: platform-driver-x86, linux-kernel, stable
Hi,
On 3-Nov-26 11:55 AM, Wentao Liang wrote:
> lenovo_yoga_tab2_830_1050_init_codec() stores the codec device reference,
> the pinctrl handle and the pin mappings in globals on success; they are
> only released by lenovo_yoga_tab2_830_1050_exit(). If the
> register_sys_off_handler() call which follows it fails, the init callback
> returns an error before the exit callback has been registered with the
> framework, so the codec device reference and the other resources are
> never released.
>
> Factor the codec teardown out into a helper and call it from the error
> path of both init callbacks.
>
> Fixes: 4ce8f4c2027d ("platform/x86: x86-android-tablets: Fix Lenovo Yoga Tablet 2 830/1050 poweroff again")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> .../platform/x86/x86-android-tablets/lenovo.c | 27 +++++++++++++------
> 1 file changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
> index 52d96ae89078..294986f84ce8 100644
> --- a/drivers/platform/x86/x86-android-tablets/lenovo.c
> +++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
> @@ -548,6 +548,14 @@ static int __init lenovo_yoga_tab2_830_1050_init_codec(void)
> return ret;
> }
>
> +static void lenovo_yoga_tab2_830_1050_exit_codec(void)
> +{
> + device_remove_software_node(lenovo_yoga_tab2_830_1050_codec_dev);
> + pinctrl_put(lenovo_yoga_tab2_830_1050_codec_pinctrl);
> + pinctrl_unregister_mappings(&lenovo_yoga_tab2_830_1050_codec_pinctrl_map);
> + put_device(lenovo_yoga_tab2_830_1050_codec_dev);
> +}
> +
> /*
> * These tablet's DSDT does not set acpi_gbl_reduced_hardware, so acpi_power_off()
> * gets used as pm_power_off handler. This causes "poweroff" on these tablets
> @@ -578,8 +586,11 @@ static int __init lenovo_yoga_tab2_830_1050_init(struct device *dev)
> lenovo_yoga_tab2_830_1050_sys_off_handler =
> register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_FIRMWARE + 1,
> lenovo_yoga_tab2_830_1050_power_off, NULL);
> - if (IS_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler))
> - return PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
> + if (IS_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler)) {
> + ret = PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
> + lenovo_yoga_tab2_830_1050_exit_codec();
> + return ret;
> + }
lenovo_yoga_tab2_830_1050_exit_codec() does not touch lenovo_yoga_tab2_830_1050_sys_off_handler,
so there is no reason to store the error-code in ret before calling it.
Please just keep this line:
return PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
as-is.
>
> return 0;
> }
> @@ -588,10 +599,7 @@ static void lenovo_yoga_tab2_830_1050_exit(void)
> {
> unregister_sys_off_handler(lenovo_yoga_tab2_830_1050_sys_off_handler);
>
> - device_remove_software_node(lenovo_yoga_tab2_830_1050_codec_dev);
> - pinctrl_put(lenovo_yoga_tab2_830_1050_codec_pinctrl);
> - pinctrl_unregister_mappings(&lenovo_yoga_tab2_830_1050_codec_pinctrl_map);
> - put_device(lenovo_yoga_tab2_830_1050_codec_dev);
> + lenovo_yoga_tab2_830_1050_exit_codec();
Please also remove the empty line which was there to group all the codec
cleanup calls together which now no longer is necessary.
> }
>
> /*
> @@ -776,8 +784,11 @@ static int __init lenovo_yoga_tab2_1380_init(struct device *dev)
> lenovo_yoga_tab2_830_1050_sys_off_handler =
> register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_FIRMWARE + 1,
> lenovo_yoga_tab2_830_1050_power_off, NULL);
> - if (IS_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler))
> - return PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
> + if (IS_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler)) {
> + ret = PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
> + lenovo_yoga_tab2_830_1050_exit_codec();
> + return ret;
> + }
Same as above, please keep this line:
return PTR_ERR(lenovo_yoga_tab2_830_1050_sys_off_handler);
as-is.
Regards,
Hans
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-03 16:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 10:55 [PATCH] platform/x86: x86-android-tablets: fix codec teardown if poweroff handler setup fails Wentao Liang
2026-11-03 11:10 ` Krzysztof Kozlowski
2026-11-03 16:28 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®