From c69e3c3a0c014e86750e78b7e2ae823f7a9b2cb2 Mon Sep 17 00:00:00 2001 From: Vishnu Pratap Singh Date: Thu, 25 Jun 2015 15:03:37 -0700 Subject: [PATCH] init/do_mounts.c: add create_dev() failure log If create_dev() function fails to create the root mount device (/dev/root), then it goes to panic as root device not found but there is no printk in this case. So I have added the log in case it fails to create the root device. It will help in debugging. [akpm@linux-foundation.org: simplify printk(), use pr_emerg(), display errno] Signed-off-by: Vishnu Pratap Singh Acked-by: Pavel Machek Cc: Paul Gortmaker Cc: Mike Snitzer Cc: Dan Ehrenberg Cc: Miklos Szeredi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- init/do_mounts.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/init/do_mounts.c b/init/do_mounts.c index a95bbdb2a502..dea5de95c2dd 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -533,8 +533,13 @@ void __init mount_root(void) } #endif #ifdef CONFIG_BLOCK - create_dev("/dev/root", ROOT_DEV); - mount_block_root("/dev/root", root_mountflags); + { + int err = create_dev("/dev/root", ROOT_DEV); + + if (err < 0) + pr_emerg("Failed to create /dev/root: %d\n", err); + mount_block_root("/dev/root", root_mountflags); + } #endif } -- 2.34.1