summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/it87.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2017-02-08 14:02:59 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-12 06:44:08 +0100
commit75225bc818b06b2a354540c0db01d42c2560443b (patch)
tree46fedac52e328ed8457e630d1b6a5b0ec33e4cac /drivers/hwmon/it87.c
parent3b43f4161a5fa85347bb4898b5559841b4addc4b (diff)
downloadlinux-stable-75225bc818b06b2a354540c0db01d42c2560443b.tar.gz
linux-stable-75225bc818b06b2a354540c0db01d42c2560443b.tar.bz2
linux-stable-75225bc818b06b2a354540c0db01d42c2560443b.zip
hwmon: (it87) Ensure that pwm control cache is current before updating values
commit 82dbe987b70042b340f851bdc969a971081e5f02 upstream. 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. Reported-by: Kevin Folz <kfolz@evertz.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 991e0fce781e..43146162c122 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -1354,6 +1354,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
return -EINVAL;
mutex_lock(&data->update_lock);
+ it87_update_pwm_ctrl(data, nr);
if (has_newer_autopwm(data)) {
/*
* If we are in automatic mode, the PWM duty cycle register
@@ -1466,6 +1467,7 @@ static ssize_t set_pwm_temp_map(struct device *dev,
}
mutex_lock(&data->update_lock);
+ it87_update_pwm_ctrl(data, nr);
data->pwm_temp_map[nr] = reg;
/*
* If we are in automatic mode, write the temp mapping immediately;