Re: [hwmon PATCH v3 6/6] hwmon: (adt7470) Use cached PWM frequency value
From: Guenter Roeck
Date: Mon Jul 27 2026 - 10:42:00 EST
On 7/26/26 20:34, Luiz Angelo Daros de Luca wrote:
adt7470_pwm_read() currently ignores failures returned by
pwm1_freq_get(). If the register read fails, the negative error code is
returned through *val while the function itself reports success,
potentially exposing a negative PWM frequency through sysfs.
Fix this by using the cached PWM frequency maintained by the driver,
eliminating the register access from the read path.
Apart from the corrected error propagation and using the cached value,
no functional change is intended.
An alternative might be to use regmap for caching and drop all driver-internal
caching. I have done that for other drivers; typically it simplifies the code,
sometimes significantly, since the update_device() function is no longer needed.
Something to consider for later, maybe.
Thanks,
Guenter