Re: [PATCH] hwmon: (pcf8591) Propagate channel access errors

From: Guenter Roeck

Date: Tue Nov 17 2026 - 11:07:43 EST


On 11/17/26 03:38, Siqi Chen wrote:
The SMBus channel operations return negative error codes on failure.
The final read result is stored in a u8, causing an error to be
truncated and exposed through sysfs as a valid ADC value. Errors from
the channel selection and dummy read are also ignored.

Check all three operations and propagate their errors through sysfs.
Keep the cached channel invalid until both channel selection and the
dummy read succeed so that a later read retries synchronization after
a failure.

An AI coding assistant was used to identify the issue and help develop
the fix.

The change was compile-tested with W=1. No hardware testing was
performed.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Siqi Chen <chensiqi@xxxxxxxxxxxxx>

This is an old driver, using a long since deprecated hwmon API which
generates a warning message during boot. Such drivers will need to
be converted to a supported API, and the result will need to be tested
at the very least on simulated hardware, before accepting any other
changes.

Thanks,
Guenter