Re: [patch] w1: silence an uninitialized variable warning

From: Evgeniy Polyakov
Date: Wed Apr 27 2016 - 07:20:42 EST


Hi Dan

14.04.2016, 12:36, "Dan Carpenter" <dan.carpenter@xxxxxxxxxx>:
> If kstrtoint() returns -ERANGE then "tmp" is uninitialized.

Looks good to me, please pull it into janitors tree

> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Acked-by: Evgeniy Polaykov <zbr@xxxxxxxxxxx>

> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index 89a7847..bb34362 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -335,7 +335,7 @@ static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev,
>          int tmp;
>          struct w1_master *md = dev_to_w1_master(dev);
>
> - if (kstrtoint(buf, 0, &tmp) == -EINVAL || tmp < 1)
> + if (kstrtoint(buf, 0, &tmp) || tmp < 1)
>                  return -EINVAL;
>
>          mutex_lock(&md->mutex);