Re: [PATCH] hwmon: (ntc_thermistor) Simplify if sequence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 18 Aug 2011 10:49:15 -0700, Guenter Roeck wrote:
> Replace unnecessary if with else statement.
> 
> This fixes the following (false) compile warning reported with some combinations
> of C compiler version and configuration.
> 
> drivers/hwmon/ntc_thermistor.c: In function 'ntc_show_temp':
> drivers/hwmon/ntc_thermistor.c:225: warning: 'low' may be used uninitialized in
> this function
> drivers/hwmon/ntc_thermistor.c:225: note: 'low' was declared here
> drivers/hwmon/ntc_thermistor.c:225: warning: 'high' may be used uninitialized in
> this function
> drivers/hwmon/ntc_thermistor.c:225: note: 'high' was declared here
> drivers/hwmon/ntc_thermistor.c:294: warning: 'temp' may be used uninitialized in
> this function
> 
> Signed-off-by: Guenter Roeck <guenter.roeck@xxxxxxxxxxxx>

Acked-by: Jean Delvare <khali@xxxxxxxxxxxx>

> ---
>  drivers/hwmon/ntc_thermistor.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
> index d7926f4..eab1161 100644
> --- a/drivers/hwmon/ntc_thermistor.c
> +++ b/drivers/hwmon/ntc_thermistor.c
> @@ -211,8 +211,7 @@ static int lookup_comp(struct ntc_data *data,
>  	if (data->comp[mid].ohm <= ohm) {
>  		*i_low = mid;
>  		*i_high = mid - 1;
> -	}
> -	if (data->comp[mid].ohm > ohm) {
> +	} else {
>  		*i_low = mid + 1;
>  		*i_high = mid;
>  	}


-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux