From: Cryolitia PukNgae Date: Fri, 19 Sep 2025 08:38:49 +0000 (+0800) Subject: hwmon: (gpd-fan) Fix range check for pwm input X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1fac317b6cae373d5d1a5695a5175c65c745922f;p=users%2Fhch%2Fmisc.git hwmon: (gpd-fan) Fix range check for pwm input Fixed the maximum value in the PWM input range check, allowing the input to be set to 255. Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver") Reported-by: Chenx Dust Link: https://github.com/Cryolitia/gpd-fan-driver/pull/18 Co-developed-by: Chenx Dust Signed-off-by: Chenx Dust Signed-off-by: Cryolitia PukNgae Link: https://lore.kernel.org/r/20250919-hwmon-v1-1-2b69c8b9c062@uniontech.com Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/gpd-fan.c b/drivers/hwmon/gpd-fan.c index e0b3b46e1bf1..644dc3ca9df7 100644 --- a/drivers/hwmon/gpd-fan.c +++ b/drivers/hwmon/gpd-fan.c @@ -571,7 +571,7 @@ static int gpd_fan_hwmon_write(__always_unused struct device *dev, ret = 0; goto OUT; case hwmon_pwm_input: - if (!in_range(val, 0, 255)) { + if (!in_range(val, 0, 256)) { ret = -ERANGE; goto OUT; }