gen_probe.c issue

Alice Hennessy ahennessy at mvista.com
Wed Jan 28 19:18:21 EST 2004


Hi,

The following patch fixes a problem seen when the map->size is less than
the actual chip size.
Without the fix,  max_chips gets set to 0.

Alice

Index: drivers/mtd/chips/gen_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/gen_probe.c,v
retrieving revision 1.14
diff -u -r1.14 gen_probe.c
--- drivers/mtd/chips/gen_probe.c       8 Nov 2003 00:51:21 -0000
1.14
+++ drivers/mtd/chips/gen_probe.c       28 Jan 2004 23:58:38 -0000
@@ -108,6 +108,9 @@
         * Align bitmap storage size to full byte.
         */
        max_chips = map->size >> cfi.chipshift;
+        /* correct for case where map->size is less than chip size */
+        if (!max_chips)
+                max_chips = 1;
        chip_map = kmalloc((max_chips / 8) + ((max_chips % 8) ? 1 : 0),
GFP_KERNEL);
        if (!chip_map) {
                printk(KERN_WARNING "%s: kmalloc failed for CFI chip
map\n", map->name);





More information about the linux-mtd mailing list