Commit 75225bc8 authored by Guenter Roeck's avatar Guenter Roeck Committed by Greg Kroah-Hartman

hwmon: (it87) Ensure that pwm control cache is current before updating values

commit 82dbe987 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: default avatarKevin Folz <kfolz@evertz.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3b43f416
...@@ -1354,6 +1354,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, ...@@ -1354,6 +1354,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
return -EINVAL; return -EINVAL;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
it87_update_pwm_ctrl(data, nr);
if (has_newer_autopwm(data)) { if (has_newer_autopwm(data)) {
/* /*
* If we are in automatic mode, the PWM duty cycle register * 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, ...@@ -1466,6 +1467,7 @@ static ssize_t set_pwm_temp_map(struct device *dev,
} }
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
it87_update_pwm_ctrl(data, nr);
data->pwm_temp_map[nr] = reg; data->pwm_temp_map[nr] = reg;
/* /*
* If we are in automatic mode, write the temp mapping immediately; * If we are in automatic mode, write the temp mapping immediately;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment