[PATCH] hwmon: (gpd-fan) Fix range check for pwm input
From: Cryolitia PukNgae via B4 Relay
Date: Fri Sep 19 2025 - 04:38:51 EST
From: Cryolitia PukNgae <cryolitia@xxxxxxxxxxxxx>
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 <chenx_dust@xxxxxxxxxxx>
Link: https://github.com/Cryolitia/gpd-fan-driver/pull/18
Co-developed-by: Chenx Dust <chenx_dust@xxxxxxxxxxx>
Signed-off-by: Chenx Dust <chenx_dust@xxxxxxxxxxx>
Signed-off-by: Cryolitia PukNgae <cryolitia@xxxxxxxxxxxxx>
---
drivers/hwmon/gpd-fan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/gpd-fan.c b/drivers/hwmon/gpd-fan.c
index e0b3b46e1bf12a10097600f857c627a766f61a27..644dc3ca9df7da0174e513c47a820a6ff39eb0ef 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;
}
---
base-commit: 80038a758b7fc0cdb6987532cbbf3f75b13e0826
change-id: 20250919-hwmon-9703a3da195a
Best regards,
--
Cryolitia PukNgae <cryolitia@xxxxxxxxxxxxx>