mtd/drivers/mtd/onenand onenand_base.c,1.8,1.9

kyungmin.park at samsung.com kyungmin.park at samsung.com
Fri Dec 2 02:43:40 EST 2005


Update of /home/cvs/mtd/drivers/mtd/onenand
In directory phoenix.infradead.org:/tmp/cvs-serv15155/drivers/mtd/onenand

Modified Files:
	onenand_base.c 
Log Message:
[MTD] OneNAND: check correct manufacturer

There's a bug releated with checking manufacturer
It compares the index with manufacturer ID.


Index: onenand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/onenand/onenand_base.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- onenand_base.c	29 Nov 2005 14:49:36 -0000	1.8
+++ onenand_base.c	2 Dec 2005 07:43:37 -0000	1.9
@@ -1346,7 +1346,6 @@
 
 static const struct onenand_manufacturers onenand_manuf_ids[] = {
         {ONENAND_MFR_SAMSUNG, "Samsung"},
-        {ONENAND_MFR_UNKNOWN, "Unknown"}
 };
 
 /**
@@ -1357,17 +1356,22 @@
  */
 static int onenand_check_maf(int manuf)
 {
+	int size = ARRAY_SIZE(onenand_manuf_ids);
+	char *name;
         int i;
 
-        for (i = 0; onenand_manuf_ids[i].id; i++) {
+        for (i = 0; i < size; i++)
                 if (manuf == onenand_manuf_ids[i].id)
                         break;
-        }
 
-        printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n",
-                onenand_manuf_ids[i].name, manuf);
+	if (i < size)
+		name = onenand_manuf_ids[i].name;
+	else
+		name = "Unknown";
+
+        printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n", name, manuf);
 
-        return (i != ONENAND_MFR_UNKNOWN);
+        return (i == size);
 }
 
 /**





More information about the linux-mtd-cvs mailing list