[PATCH] gen_probe forgets to clean chip_map

Robert Schwebel robert at schwebel.de
Sat Jul 3 07:03:25 EDT 2004


On systems that have more than one flash chip in a probe window with
some space between the chips we recently found that erase operations are
performed on the wrong chip. This comes from the chip_map being
allocated in genprobe_ident_chips() but it is never cleaned before being
used. Here is a patch: 

----------8<----------
diff -urN mtd-20040622-1/drivers/mtd/chips/gen_probe.c mtd-20040622-1-ptx1/drivers/mtd/chips/gen_probe.c
--- mtd-20040622-1/drivers/mtd/chips/gen_probe.c	2003-11-09 00:00:04.000000000 +0100
+++ mtd-20040622-1-ptx1/drivers/mtd/chips/gen_probe.c	2004-06-25 14:38:28.000000000 +0200
@@ -114,6 +114,7 @@
 		kfree(cfi.cfiq);
 		return NULL;
 	}
+	memset(chip_map, 0, ((max_chips / 8) + ((max_chips % 8) ? 1 : 0)));
 
 	set_bit(0, chip_map); /* Mark first chip valid */
----------8<----------
 
Signed-off-by: Robert Schwebel <r.schwebel at pengutronix.de>
Signed-off-by: Benedikt Spranger <b.spranger at pengutronix.de>
Signed-off-by: Kai-Uwe Bloem <linux-development at auerswald.de>

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hornemannstraße 12,  31137 Hildesheim, Germany
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4




More information about the linux-mtd mailing list