[PATCH] vfs: init/main.c: change comment: opening /dev/console may fail
Askar Safin <[email protected]> Mon, 6 Apr 2026 09:08:15 +0000
| Newsgroups | org.kernel.vger.initramfs,dev.linux.lists.patches,org.kernel.vger.kernel-janitors,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
This patch is for VFS. Today comment on console_on_rootfs says that opening /dev/console never fails. This is false. The opening may fail if /dev/console is not present in internal initramfs. So let's update the comment. I tried to fix the problem itself in [1], but the patchset was rejected, so I will fix the comment instead. :) Link: https://lore.kernel.org/all/[email protected]/ # [1] Signed-off-by: Askar Safin <[email protected]> --- init/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init/main.c b/init/main.c index 1cb395dd9..40cfda9aa 100644 --- a/init/main.c +++ b/init/main.c @@ -1645,7 +1645,10 @@ static int __ref kernel_init(void *unused) "See Linux Documentation/admin-guide/init.rst for guidance."); } -/* Open /dev/console, for stdin/stdout/stderr, this should never fail */ +/* + * Open /dev/console, for stdin/stdout/stderr, this may fail if you supplied + * your own internal initramfs without /dev/console + */ void __init console_on_rootfs(void) { struct file *file = filp_open("/dev/console", O_RDWR, 0); base-commit: 591cd656a1bf5ea94a222af5ef2ee76df029c1d2 (mainline) -- 2.47.3