linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] UBI: do not abort init when ubi.mtd devices cannot be found
@ 2013-04-23  1:40 Mike Frysinger
  2013-05-16  9:41 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2013-04-23  1:40 UTC (permalink / raw)
  To: linux-mtd, Artem Bityutskiy, Adrian Hunter

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>
---
 drivers/mtd/ubi/build.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index eaa2d4e..474bc89 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -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);
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] UBI: do not abort init when ubi.mtd devices cannot be found
  2013-04-23  1:40 [PATCH] UBI: do not abort init when ubi.mtd devices cannot be found Mike Frysinger
@ 2013-05-16  9:41 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2013-05-16  9:41 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd, Adrian Hunter

On Mon, 2013-04-22 at 21:40 -0400, Mike Frysinger wrote:
> 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.

Pushed to linux-ubi.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-16  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23  1:40 [PATCH] UBI: do not abort init when ubi.mtd devices cannot be found Mike Frysinger
2013-05-16  9:41 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).