[PATCH] hwmon: (gpd-fan) Fix range check for pwm input

Cryolitia PukNgae via B4 Relay posted 1 patch 1 week, 5 days ago
drivers/hwmon/gpd-fan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] hwmon: (gpd-fan) Fix range check for pwm input
Posted by Cryolitia PukNgae via B4 Relay 1 week, 5 days ago
From: Cryolitia PukNgae <cryolitia@uniontech.com>

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@outlook.com>
Link: https://github.com/Cryolitia/gpd-fan-driver/pull/18
Co-developed-by: Chenx Dust <chenx_dust@outlook.com>
Signed-off-by: Chenx Dust <chenx_dust@outlook.com>
Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
---
 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@uniontech.com>
Re: [PATCH] hwmon: (gpd-fan) Fix range check for pwm input
Posted by Guenter Roeck 1 week ago
On Fri, Sep 19, 2025 at 04:38:49PM +0800, Cryolitia PukNgae wrote:
> From: Cryolitia PukNgae <cryolitia@uniontech.com>
> 
> 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@outlook.com>
> Link: https://github.com/Cryolitia/gpd-fan-driver/pull/18
> Co-developed-by: Chenx Dust <chenx_dust@outlook.com>
> Signed-off-by: Chenx Dust <chenx_dust@outlook.com>
> Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>

Applied.
Guenter