Skip to contentSkip to conversation

mtd: silence some uninitialized variable warnings

PATCH Applied Dan Carpenter 2 participants 2 messages Apr 13, 2016 – Jul 10, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

drivers/mtd/onenand/onenand_base.c +2 -2
index af28bb3..006a464 100644
@@ -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--;
 	}
Applied
#1 lore raw
Quoted 5 lines · Dan Carpenter

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.

Applied to l2-mtd.git