Skip to contentSkip to conversation

UBI: silence an unintialized variable warning

PATCH New Dan Carpenter 1 participant 1 message Apr 13, 2016

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

PATCH 1/1 UBI: silence an unintialized variable warning

My static checker complains that "val" is uninitialized when kstrtoint() fails.

drivers/mtd/ubi/debug.c +2 -1
index c4cb15a..f101a49 100644
@@ -352,7 +352,8 @@ static ssize_t dfs_file_write(struct file *file, const char __user *user_buf,
 	} else if (dent = d->dfs_emulate_power_cut) {
 		if (kstrtoint(buf, 0, &val) != 0)
 			count = -EINVAL;
-		d->emulate_power_cut = val;
+		else
+			d->emulate_power_cut = val;
 		goto out;
 	}