[PATCH v2 0/2] power: supply: max17040: fix error-path state handling

From: Jianing Li

Date: Mon Nov 02 2026 - 06:01:53 EST


This series fixes two independent error paths in the MAX17040 family
driver. The first keeps the cached alert threshold unchanged when the
register access fails. The second propagates an IRQ request failure so
MAX17048 and MAX17049 do not bind without either SOC alerts or polling.

The second issue is specific to configurations using an alert IRQ; it does
not affect a MAX17040 running without interrupts.

Both issues are present in Torvalds' master at
6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 and in the power-supply for-next
file checked on 2026-11-02. This series is based on that master version.

Changes since v1:
- Rewrite the second commit message to describe the observed control flow
and the fix directly.

Validation: a standalone C harness extracts the original driver setter,
probe, suspend/resume and work helpers and mocks register, IRQ and managed
resource operations. It reproduces the cache inconsistency on -EIO and the
uninitialized-work path on IRQ request errors. All 30 checks pass with the
patches, including no-IRQ polling, successful IRQ setup, invalid thresholds
and the double-SOC conversion. Both patches pass checkpatch.

This is software fault-injection testing; no full kernel build or hardware
runtime test was performed.

Jianing Li (2):
power: supply: max17040: preserve alert threshold on write failure
power: supply: max17040: fail probe when requesting the alert IRQ
fails

drivers/power/supply/max17040_battery.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

--
2.23.0.windows.1