From a0ef976e07ff1e4c542d523e534b5ce506b204fc Mon Sep 17 00:00:00 2001 From: Vishnu Pratap Singh Date: Fri, 29 May 2015 10:16:00 +1000 Subject: 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. 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 --- init/do_mounts.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'init/do_mounts.c') diff --git a/init/do_mounts.c b/init/do_mounts.c index a95bbdb2a502..3b7c1e4ddb1b 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -533,7 +533,8 @@ void __init mount_root(void) } #endif #ifdef CONFIG_BLOCK - create_dev("/dev/root", ROOT_DEV); + if (create_dev("/dev/root", ROOT_DEV) < 0) + pr_err("Failed to create %s device !\n", "/dev/root"); mount_block_root("/dev/root", root_mountflags); #endif } -- cgit v1.2.3 From 12fcd415a2d152c985af5bf4e5f5befd4ba2aa6b Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 29 May 2015 10:16:00 +1000 Subject: init-do_mounts-add-create_dev-failure-log-fix simplify printk(), use pr_emerg(), display errno Cc: Dan Ehrenberg Cc: Mike Snitzer Cc: Miklos Szeredi Cc: Paul Gortmaker Cc: Pavel Machek Cc: Vishnu Pratap Singh Signed-off-by: Andrew Morton --- init/do_mounts.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'init/do_mounts.c') diff --git a/init/do_mounts.c b/init/do_mounts.c index 3b7c1e4ddb1b..dea5de95c2dd 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -533,9 +533,13 @@ void __init mount_root(void) } #endif #ifdef CONFIG_BLOCK - if (create_dev("/dev/root", ROOT_DEV) < 0) - pr_err("Failed to create %s device !\n", "/dev/root"); - 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 } -- cgit v1.2.3