[PATCH 2/2] mtdpart: Do not shadow symbol 'i'

Atsushi Nemoto anemo at mba.ocn.ne.jp
Mon Jun 16 10:32:25 EDT 2008


This patch kills this sparse warning:

linux/drivers/mtd/mtdpart.c:448:8: warning: symbol 'i' shadows an earlier one
linux/drivers/mtd/mtdpart.c:338:6: originally declared here

Signed-off-by: Atsushi Nemoto <anemo at mba.ocn.ne.jp>
---
This is broken-out patch from "[PATCH RESEND] mtdpart: Avoid
divide-by-zero on out-of-reach path" on Sat, 14 Jun 2008 23:45:40

 drivers/mtd/mtdpart.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index a7a82c7..5732dc0 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -445,18 +445,18 @@ int add_mtd_partitions(struct mtd_info *master,
 		}
 		if (master->numeraseregions>1) {
 			/* Deal with variable erase size stuff */
-			int i;
+			int j;
 			struct mtd_erase_region_info *regions = master->eraseregions;
 
 			/* Find the first erase regions which is part of this partition. */
-			for (i=0; i < master->numeraseregions && slave->offset >= regions[i].offset; i++)
+			for (j=0; j < master->numeraseregions && slave->offset >= regions[j].offset; j++)
 				;
 
-			i--;
-			slave->mtd.erasesize = regions[i].erasesize;
-			for (; i < master->numeraseregions && slave->offset + slave->mtd.size > regions[i].offset; i++) {
-				if (slave->mtd.erasesize < regions[i].erasesize) {
-					slave->mtd.erasesize = regions[i].erasesize;
+			j--;
+			slave->mtd.erasesize = regions[j].erasesize;
+			for (; j < master->numeraseregions && slave->offset + slave->mtd.size > regions[j].offset; j++) {
+				if (slave->mtd.erasesize < regions[j].erasesize) {
+					slave->mtd.erasesize = regions[j].erasesize;
 				}
 			}
 		} else {



More information about the linux-mtd mailing list