staging: omap-thermal: bandgap: fix setting of alert thresholds
authorRadhesh Fadnis <radhesh.fadnis@ti.com>
Wed, 19 Sep 2012 17:07:49 +0000 (20:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Sep 2012 15:56:40 +0000 (08:56 -0700)
There was an error in check for the valid temperature in
function temp_to_adc_conversion. The temperature value was
compared with higher limit for less than condition as well,
resulting in returning -EINVAL. Corrected the check condition
to properly check for lower and higher temperature limits.

Signed-off-by: Radhesh Fadnis <radhesh.fadnis@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/omap-thermal/omap-bandgap.c

index ff93c15d349bba2e23466c9da30daca34565797a..368a2e19b2d4581e04f694df0369761011552665 100644 (file)
@@ -157,7 +157,7 @@ static int temp_to_adc_conversion(long temp, struct omap_bandgap *bg_ptr, int i,
        high = ts_data->adc_end_val - ts_data->adc_start_val;
        mid = (high + low) / 2;
 
-       if (temp < bg_ptr->conv_table[high] || temp > bg_ptr->conv_table[high])
+       if (temp < bg_ptr->conv_table[low] || temp > bg_ptr->conv_table[high])
                return -EINVAL;
 
        while (low < high) {