summaryrefslogtreecommitdiff
path: root/drivers/hwmon/adt7470.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-14 09:02:51 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-14 09:02:51 +0100
commit1e7f32f776089af32b6ec9b801fe976778c8448b (patch)
treef836aacfcae8443c6ca55855e2107714e6a75e65 /drivers/hwmon/adt7470.c
parentf2c461536226eb0852a241e72b9125685d6741b4 (diff)
parent754e0b0e35608ed5206d6a67a791563c631cec07 (diff)
Merge 5.17-rc4 into staging-testing
We need the staging driver fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwmon/adt7470.c')
-rw-r--r--drivers/hwmon/adt7470.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index d519aca4a9d6..fb6d14d213a1 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -662,6 +662,9 @@ static int adt7470_fan_write(struct device *dev, u32 attr, int channel, long val
struct adt7470_data *data = dev_get_drvdata(dev);
int err;
+ if (val <= 0)
+ return -EINVAL;
+
val = FAN_RPM_TO_PERIOD(val);
val = clamp_val(val, 1, 65534);