* [patch] mtd: silence some uninitialized variable warnings
@ 2016-04-13 6:42 Dan Carpenter
2016-07-10 1:50 ` Brian Norris
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-04-13 6:42 UTC (permalink / raw)
To: Kyungmin Park; +Cc: David Woodhouse, Brian Norris, linux-mtd, kernel-janitors
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>
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index af28bb3..006a464 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -3201,13 +3201,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--;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-10 1:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-13 6:42 [patch] mtd: silence some uninitialized variable warnings Dan Carpenter
2016-07-10 1:50 ` Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).