summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/it87.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2017-02-08 17:02:59 -0500
committerGuenter Roeck <linux@roeck-us.net>2017-02-11 00:35:08 -0500
commit82dbe987b70042b340f851bdc969a971081e5f02 (patch)
tree19558b051636f6c370f1bf5a452b971c64ff0655 /drivers/hwmon/it87.c
parent638c1c07f99b752c14502009b50ffe4dd4de5ae2 (diff)
hwmon: (it87) Ensure that pwm control cache is current before updating values
If sensor attributes were never read, the pwm control data has not been initiialized, which can cause wrong driver behavior. Ensure that cached data is current before acting on it. Cc: stable@vger.kernel.org # 4.4+ Reported-by: Kevin Folz <kfolz@evertz.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/it87.c')
-rw-r--r--drivers/hwmon/it87.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 11a28b233006..85918d8a747a 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -1360,6 +1360,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
1360 return -EINVAL; 1360 return -EINVAL;
1361 1361
1362 mutex_lock(&data->update_lock); 1362 mutex_lock(&data->update_lock);
1363 it87_update_pwm_ctrl(data, nr);
1363 if (has_newer_autopwm(data)) { 1364 if (has_newer_autopwm(data)) {
1364 /* 1365 /*
1365 * If we are in automatic mode, the PWM duty cycle register 1366 * If we are in automatic mode, the PWM duty cycle register
@@ -1472,6 +1473,7 @@ static ssize_t set_pwm_temp_map(struct device *dev,
1472 } 1473 }
1473 1474
1474 mutex_lock(&data->update_lock); 1475 mutex_lock(&data->update_lock);
1476 it87_update_pwm_ctrl(data, nr);
1475 data->pwm_temp_map[nr] = reg; 1477 data->pwm_temp_map[nr] = reg;
1476 /* 1478 /*
1477 * If we are in automatic mode, write the temp mapping immediately; 1479 * If we are in automatic mode, write the temp mapping immediately;