From: Guenter Roeck Date: Tue, 27 Sep 2016 00:35:56 +0000 (-0700) Subject: Ensure that pwm control cache is current before updating values X-Git-Tag: v1.0~57 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bb613ebca48dc1cf803542d41ec59283c8d2ce5f;p=groeck-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. Reported-by: Kevin Folz Signed-off-by: Guenter Roeck --- diff --git a/it87.c b/it87.c index e6ca420..f028820 100644 --- a/it87.c +++ b/it87.c @@ -1361,6 +1361,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 @@ -1473,6 +1474,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;