mtd: sm_ftl: initialize error code

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Oct 15 23:59:03 PDT 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=f7f0d358f5f2f1133b5a14337028ddab848cd74e
Commit:     f7f0d358f5f2f1133b5a14337028ddab848cd74e
Parent:     0c2b4e21444d0e274e91fc7db85caddb30988853
Author:     Brian Norris <computersforpeace at gmail.com>
AuthorDate: Mon Jul 21 19:06:39 2014 -0700
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Tue Aug 19 11:53:07 2014 -0700

    mtd: sm_ftl: initialize error code
    
    There is one theoretical case that could fall through to using an
    uninitialized value as the return code. Let's give it a value of 0.
    
    Untested.
    
    Caught by Coverity.
    
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/sm_ftl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
index cf49c22..c23184a 100644
--- a/drivers/mtd/sm_ftl.c
+++ b/drivers/mtd/sm_ftl.c
@@ -1058,7 +1058,7 @@ static int sm_write(struct mtd_blktrans_dev *dev,
 {
 	struct sm_ftl *ftl = dev->priv;
 	struct ftl_zone *zone;
-	int error, zone_num, block, boffset;
+	int error = 0, zone_num, block, boffset;
 
 	BUG_ON(ftl->readonly);
 	sm_break_offset(ftl, sec_no << 9, &zone_num, &block, &boffset);



More information about the linux-mtd-cvs mailing list