projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8a0806d
)
hwmon: (max31827) Return closest value in update_interval
author
Daniel Matyas
<daniel.matyas@analog.com>
Tue, 31 Oct 2023 18:21:56 +0000
(20:21 +0200)
committer
Guenter Roeck
<linux@roeck-us.net>
Mon, 11 Dec 2023 14:42:54 +0000
(06:42 -0800)
When user writes a value to update_interval which does not match the
possible values, instead of returning invalid error, return the closest
value.
Signed-off-by: Daniel Matyas <daniel.matyas@analog.com>
Link:
https://lore.kernel.org/r/20231031182158.124608-4-daniel.matyas@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/max31827.c
patch
|
blob
|
history
diff --git
a/drivers/hwmon/max31827.c
b/drivers/hwmon/max31827.c
index 3b38fdf0ebb2dfa363eb9d331e6bac3787c88c6c..6b7bfacf6f0ad1d062874df639d37f1ce6b87691 100644
(file)
--- a/
drivers/hwmon/max31827.c
+++ b/
drivers/hwmon/max31827.c
@@
-361,9
+361,8
@@
static int max31827_write(struct device *dev, enum hwmon_sensor_types type,
val < max31827_conversions[res])
res++;
- if (res == ARRAY_SIZE(max31827_conversions) ||
- val != max31827_conversions[res])
- return -EINVAL;
+ if (res == ARRAY_SIZE(max31827_conversions))
+ res = ARRAY_SIZE(max31827_conversions) - 1;
res = FIELD_PREP(MAX31827_CONFIGURATION_CNV_RATE_MASK,
res);