[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <32dfd23a-7fa2-77d7-b4e5-3cfa90933ff5@linux.intel.com>
Date: Mon, 7 Apr 2025 19:30:47 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Wentao Liang <vulab@...as.ac.cn>
cc: hmh@....eng.br, Hans de Goede <hdegoede@...hat.com>,
ibm-acpi-devel@...ts.sourceforge.net, platform-driver-x86@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>, stable@...r.kernel.org
Subject: Re: [PATCH v2] platform/x86: thinkpad-acpi: Add error check for
tpacpi_check_quirks()
On Mon, 7 Apr 2025, Wentao Liang wrote:
> In tpacpi_battery_init(), the return value of tpacpi_check_quirks() needs
> to be checked. The battery should not be hooked if there is no matched
> battery information in quirk table.
>
> Add an error check and return -ENODEV immediately if the device fail
> the check.
>
> Fixes: 1a32ebb26ba9 ("platform/x86: thinkpad_acpi: Support battery quirk")
> Cc: stable@...r.kernel.org
> Signed-off-by: Wentao Liang <vulab@...as.ac.cn>
> ---
> v2: Fix double assignment error.
>
> 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 2cfb2ac3f465..93eaca3bd9d1 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -9973,7 +9973,9 @@ static int __init tpacpi_battery_init(struct ibm_init_struct *ibm)
>
> tp_features.battery_force_primary = tpacpi_check_quirks(
> battery_quirk_table,
> - ARRAY_SIZE(battery_quirk_table));
> + ARRAY_SIZE(battery_quirk_table))
Fine, using the same variable is okay but this will fail build as remove
that semicolon.
> + if (!tp_features.battery_force_primary)
> + return -ENODEV;
>
> battery_hook_register(&battery_hook);
> return 0;
>
--
i.
Powered by blists - more mailing lists