Re: [PATCH v3] platform/x86: thinkpad-acpi: Add error check for tpacpi_check_quirks

From: Kurt Borja
Date: Tue Apr 08 2025 - 01:09:01 EST


Hi Wentao,

On Mon Apr 7, 2025 at 10:39 PM -03, 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.

Why is this the case? What problem is this fixing?

It seems only a few devices are listed in battery_quirk_table, and the
comment above it suggests it is just a fixup:

/*
* Individual addressing is broken on models that expose the
* primary battery as BAT1.
*/

Furthermore, I looked at uses of this quirk in the code and it's absence
doesn't seem critical.

>
> Add an error check and return -ENODEV immediately if the device fail
> the check.

I bring this up because it has the potential to cause a regression on a
lot of devices.

--
~ Kurt