fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / mtd / maps / beech-mtd.c
index 5e79c9d..d76d598 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * $Id: beech-mtd.c,v 1.10 2004/11/04 13:24:14 gleixner Exp $
- * 
- * drivers/mtd/maps/beech-mtd.c MTD mappings and partition tables for 
+ * $Id: beech-mtd.c,v 1.11 2005/11/07 11:14:26 gleixner Exp $
+ *
+ * drivers/mtd/maps/beech-mtd.c MTD mappings and partition tables for
  *                              IBM 405LP Beech boards.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -72,6 +72,8 @@ static struct mtd_partition beech_partitions[2] = {
 static int __init
 init_beech_mtd(void)
 {
+       int err;
+
        printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR);
 
        beech_mtd_map.virt = ioremap(PADDR, SIZE);
@@ -86,12 +88,20 @@ init_beech_mtd(void)
        printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8);
        beech_mtd = do_map_probe("cfi_probe", &beech_mtd_map);
 
-       if (!beech_mtd)
+       if (!beech_mtd) {
+               iounmap(beech_mtd_map.virt);
                return -ENXIO;
+       }
 
        beech_mtd->owner = THIS_MODULE;
 
-       return add_mtd_partitions(beech_mtd, beech_partitions, 2);
+       err = add_mtd_partitions(beech_mtd, beech_partitions, 2);
+       if (err) {
+               printk("%s: add_mtd_partitions failed\n", NAME);
+               iounmap(beech_mtd_map.virt);
+       }
+
+       return err;
 }
 
 static void __exit