summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand/onenand_base.c
diff options
context:
space:
mode:
authorKyungmin Park <kyungmin.park@samsung.com>2005-12-16 11:17:29 +0900
committerLinus Torvalds <torvalds@g5.osdl.org>2005-12-18 16:28:23 -0800
commit37b1cc3910f7976369fc0ed55068a686e92555e6 (patch)
treea4560bd6c25546e43d266a8b1f5f6f9d6d177421 /drivers/mtd/onenand/onenand_base.c
parentee219e5e7c12b742243a080e2d8d288a48a32e44 (diff)
[PATCH] mtd onenand driver: check correct manufacturer
This (and the three subsequent patches) is working well on OMAP H4 with 2.6.15-rc4 kernel and passes the LTP fs test. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/mtd/onenand/onenand_base.c')
-rw-r--r--drivers/mtd/onenand/onenand_base.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index f67d5d6eb9a..33d6f5c2e05 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -1346,7 +1346,6 @@ static void onenand_print_device_info(int device)
static const struct onenand_manufacturers onenand_manuf_ids[] = {
{ONENAND_MFR_SAMSUNG, "Samsung"},
- {ONENAND_MFR_UNKNOWN, "Unknown"}
};
/**
@@ -1357,17 +1356,22 @@ static const struct onenand_manufacturers onenand_manuf_ids[] = {
*/
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);
}
/**