]> git.ipfire.org Git - thirdparty/linux.git/commit
hwmon: (adt7470) Use cached PWM frequency value
authorLuiz Angelo Daros de Luca <luizluca@gmail.com>
Tue, 28 Jul 2026 00:22:22 +0000 (21:22 -0300)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 28 Jul 2026 00:57:22 +0000 (17:57 -0700)
commit60677cd4c28f44d5b307d3029dccece38fcce90f
tree27baa1ace4a43f052f9b207472a5feeb41f7e5fe
parenta3850231521b06bbbb18c8ebea100320c14a08be
hwmon: (adt7470) Use cached PWM frequency value

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.

Fixes: ef67959c4253 ("hwmon: (adt7470) Convert to use regmap")
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Link: https://lore.kernel.org/r/20260727-adt7470_fixes-v2-6-598e38a46ba6@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/adt7470.c