Skip to contentSkip to conversation

mtd: sm_ftl: initialize error code

PATCH New Brian Norris 1 participant 1 message Jul 22, 2014 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/mtd/sm_ftl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/sm_ftl.c +1 -1
index cf49c22673b9..c23184a47fc4 100644
@@ -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);
Signature · 1 line
1.9.1