mtd: silence some uninitialized variable warnings
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Mon Aug 1 18:59:02 PDT 2016
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=c3cb77f8980db9dba614822d2d4a4cc61e44c8e2
Commit: c3cb77f8980db9dba614822d2d4a4cc61e44c8e2
Parent: ef158bdf837406a4b5f44524367d11d44da2bdf2
Author: Dan Carpenter <dan.carpenter at oracle.com>
AuthorDate: Wed Apr 13 09:42:34 2016 +0300
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Sat Jul 9 18:14:39 2016 -0700
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 at oracle.com>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/onenand/onenand_base.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index a4b029a..1a6d0e3 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--;
}
More information about the linux-mtd-cvs
mailing list