UBI: Silence an unintialized variable warning
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 13 Apr 2016 06:41:55 +0000 (09:41 +0300)
committerRichard Weinberger <richard@nod.at>
Tue, 24 May 2016 13:24:30 +0000 (15:24 +0200)
My static checker complains that "val" is uninitialized when kstrtoint()
fails.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/debug.c

index c4cb15a3098c0933f607e4f0cba170e978f910ff..f101a4985a7c39a9891fffd6a6f4f8ff36570ce4 100644 (file)
@@ -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;
        }