diff options
| author | Gabor Juhos <j4g8y7@gmail.com> | 2026-02-01 21:35:06 +0100 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-02-02 09:00:12 -0800 |
| commit | f5c092787c48296633c2dd7240752f88fa9710fc (patch) | |
| tree | 9f6174cade49ce710d92bb06fc1e2f539ee758c2 /include/uapi/linux | |
| parent | 615901b57b7ef8eb655f71358f7e956e42bcd16b (diff) | |
hwmon: (gpio-fan) Fix set_rpm() return value
The set_rpm function is used as a 'store' callback of a device attribute,
and as such it should return with the number of bytes consumed. However
since commit 0d01110e6356 ("hwmon: (gpio-fan) Add regulator support"),
the function returns with zero on success.
Due to this, the function gets called again and again whenever the user
tries to change the FAN speed by writing the desired RPM value into the
'fan1_target' sysfs attribute.
The broken behaviour can be reproduced easily. For example, the following
command never returns unless it gets terminated:
$ echo 500 > /sys/class/hwmon/hwmon1/fan1_target
^C
$
Change the code to return with the same value as the 'count' parameter
on success to indicate that all bytes from the input buffer are consumed.
The function behaved the same way prior to the offending change.
Cc: stable@vger.kernel.org
Fixes: 0d01110e6356 ("hwmon: (gpio-fan) Add regulator support")
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Link: https://lore.kernel.org/r/20260201-gpio-fan-set_rpm-retval-fix-v1-1-dc39bc7693ca@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'include/uapi/linux')
0 files changed, 0 insertions, 0 deletions
