summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-04-13 08:42:34 +0200
committerBrian Norris <computersforpeace@gmail.com>2016-07-10 03:14:39 +0200
commitc3cb77f8980db9dba614822d2d4a4cc61e44c8e2 (patch)
tree87b93f6ade6292b73845a39f370828b369a18239 /drivers/mtd/onenand
parentmtd: Remove unused symbol CONFIG_MTDRAM_ABS_POS (diff)
downloadlinux-c3cb77f8980db9dba614822d2d4a4cc61e44c8e2.tar.xz
linux-c3cb77f8980db9dba614822d2d4a4cc61e44c8e2.zip
mtd: silence some uninitialized variable warnings
The "tmp_retlen" variable can be uninitialized if action() fails. It's harmless except for the static checker warning. I have moved the error handling earlier to fix it. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/onenand')
-rw-r--r--drivers/mtd/onenand/onenand_base.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index a4b029a417f0..1a6d0e367b89 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -3188,13 +3188,13 @@ static int onenand_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,
size_t tmp_retlen;
ret = action(mtd, from, len, &tmp_retlen, buf);
+ if (ret)
+ break;
buf += tmp_retlen;
len -= tmp_retlen;
*retlen += tmp_retlen;
- if (ret)
- break;
}
otp_pages--;
}