lkml.org 
[lkml]   [2014]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.15 023/109] hwmon: (adt7470) Fix writes to temperature limit registers
    Date
    3.15-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Guenter Roeck <linux@roeck-us.net>

    commit de12d6f4b10b21854441f5242dcb29ea96181e58 upstream.

    Temperature limit registers are signed. Limits therefore need
    to be clamped to (-128, 127) degrees C and not to (0, 255)
    degrees C.

    Without this fix, writing a limit of 128 degrees C sets the
    actual limit to -128 degrees C.

    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Reviewed-by: Axel Lin <axel.lin@ingics.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/hwmon/adt7470.c | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    --- a/drivers/hwmon/adt7470.c
    +++ b/drivers/hwmon/adt7470.c
    @@ -515,7 +515,7 @@ static ssize_t set_temp_min(struct devic
    return -EINVAL;

    temp = DIV_ROUND_CLOSEST(temp, 1000);
    - temp = clamp_val(temp, 0, 255);
    + temp = clamp_val(temp, -128, 127);

    mutex_lock(&data->lock);
    data->temp_min[attr->index] = temp;
    @@ -549,7 +549,7 @@ static ssize_t set_temp_max(struct devic
    return -EINVAL;

    temp = DIV_ROUND_CLOSEST(temp, 1000);
    - temp = clamp_val(temp, 0, 255);
    + temp = clamp_val(temp, -128, 127);

    mutex_lock(&data->lock);
    data->temp_max[attr->index] = temp;
    @@ -826,7 +826,7 @@ static ssize_t set_pwm_tmin(struct devic
    return -EINVAL;

    temp = DIV_ROUND_CLOSEST(temp, 1000);
    - temp = clamp_val(temp, 0, 255);
    + temp = clamp_val(temp, -128, 127);

    mutex_lock(&data->lock);
    data->pwm_tmin[attr->index] = temp;



    \
     
     \ /
      Last update: 2014-07-26 22:21    [W:4.062 / U:0.196 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site