]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
UBI: do not abort init when ubi.mtd devices cannot be found
authorMike Frysinger <vapier@gentoo.org>
Tue, 23 Apr 2013 01:40:16 +0000 (21:40 -0400)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Thu, 16 May 2013 09:37:31 +0000 (12:37 +0300)
The current ubi.mtd parsing logic will warn & continue on when attaching
the specified mtd device fails (for any reason).  It doesn't however skip
things when the specified mtd device can't be opened.

This scenario can be hit in a couple of different ways such as:
 - build NAND controller driver as a module
 - build UBI into the kernel
 - include ubi.mtd on the kernel command line
 - boot the system
 - MTD devices don't exist, so UBI init fails

This is problematic because failing init means the entire UBI layer is
unavailable until you reboot and modify the kernel command line.  If
we just warn and continue on, /dev/ubi_ctrl is available for userland
to add UBI volumes on the fly once it loads the NAND driver.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
drivers/mtd/ubi/build.c

index 745fbc574141a7dac6cde7b18460993b5051685c..8ff08ecb9383387380e9471ba95b9f75a6982024 100644 (file)
@@ -1261,7 +1261,11 @@ static int __init ubi_init(void)
                mtd = open_mtd_device(p->name);
                if (IS_ERR(mtd)) {
                        err = PTR_ERR(mtd);
-                       goto out_detach;
+                       ubi_err("cannot open mtd %s, error %d", p->name, err);
+                       /* See comment below re-ubi_is_module(). */
+                       if (ubi_is_module())
+                               goto out_detach;
+                       continue;
                }
 
                mutex_lock(&ubi_devices_mutex);