Skip to contentSkip to conversation

w1: silence an uninitialized variable warning

PATCH In review Dan Carpenter 2 participants 2 messages Apr 14, 2016 – Apr 27, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 w1: silence an uninitialized variable warning

If kstrtoint() returns -ERANGE then "tmp" is uninitialized.

drivers/w1/w1.c +1 -1
index 89a7847..bb34362 100644
@@ -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);
Acked-by on v1 1/1
#1 lore raw

Hi Dan

14.04.2016, 12:36, "Dan Carpenter" <[email protected]>:

Quoted 1 line

If kstrtoint() returns -ERANGE then "tmp" is uninitialized.

Looks good to me, please pull it into janitors tree

Quoted 1 line

drivers/w1/w1.c static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev, · line 341

Quoted 13 lines
drivers/w1/w1.c +1 -1
index 89a7847..bb34362 100644
@@ -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);

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html