]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/mtd/maps/ocotea.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
[linux-2.6-omap-h63xx.git] / drivers / mtd / maps / ocotea.c
index c223514ca2ebef9a9da381ff7bfb93fc040edd7b..5522eac8c980854de80f5805a14fdee25986561f 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
-#include <linux/config.h>
 #include <asm/io.h>
 #include <asm/ibm44x.h>
 #include <platforms/4xx/ocotea.h>
@@ -58,8 +57,6 @@ static struct mtd_partition ocotea_large_partitions[] = {
        }
 };
 
-#define NB_OF(x)  (sizeof(x)/sizeof(x[0]))
-
 int __init init_ocotea(void)
 {
        u8 fpga0_reg;
@@ -97,9 +94,10 @@ int __init init_ocotea(void)
        if (flash) {
                flash->owner = THIS_MODULE;
                add_mtd_partitions(flash, ocotea_small_partitions,
-                                       NB_OF(ocotea_small_partitions));
+                                       ARRAY_SIZE(ocotea_small_partitions));
        } else {
                printk("map probe failed for flash\n");
+               iounmap(ocotea_small_map.virt);
                return -ENXIO;
        }
 
@@ -109,6 +107,7 @@ int __init init_ocotea(void)
 
        if (!ocotea_large_map.virt) {
                printk("Failed to ioremap flash\n");
+               iounmap(ocotea_small_map.virt);
                return -EIO;
        }
 
@@ -118,9 +117,11 @@ int __init init_ocotea(void)
        if (flash) {
                flash->owner = THIS_MODULE;
                add_mtd_partitions(flash, ocotea_large_partitions,
-                                       NB_OF(ocotea_large_partitions));
+                                       ARRAY_SIZE(ocotea_large_partitions));
        } else {
                printk("map probe failed for flash\n");
+               iounmap(ocotea_small_map.virt);
+               iounmap(ocotea_large_map.virt);
                return -ENXIO;
        }