All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] chardev: call tty_init() in real chrdev_init()
@ 2022-02-06 16:27 Xu Yu
  2022-02-06 17:03 ` Greg KH
  2022-02-08  7:02   ` [chardev] c194b1c9f0: BUG:kernel_NULL_pointer_dereference,address kernel test robot
  0 siblings, 2 replies; 6+ messages in thread
From: Xu Yu @ 2022-02-06 16:27 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel; +Cc: arnd, gregkh, viro, dhowells

It is confusing that tty_init() in called in the initialization of
memdev, i.e., static chr_dev_init().

Through blame, it is introduced by commit 31d1d48e199e ("Fix init
ordering of /dev/console vs callers of modprobe"), which fixes the
initialization order of /dev/console driver. However, there seems
to be a typo in the patch, i.e., chrdev_init, instead of chr_dev_init.

This fixes the typo, IIUC.

Note that the return value of tty_init() is always 0, and thus no error
handling is provided in chrdev_init().

Fixes: 31d1d48e199e ("Fix init ordering of /dev/console vs callers of modprobe")
Signed-off-by: Xu Yu <xuyu@linux.alibaba.com>
---
 drivers/char/mem.c | 2 +-
 fs/char_dev.c      | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index cc296f0823bd..8c90881f8115 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -775,7 +775,7 @@ static int __init chr_dev_init(void)
 			      NULL, devlist[minor].name);
 	}
 
-	return tty_init();
+	return 0;
 }
 
 fs_initcall(chr_dev_init);
diff --git a/fs/char_dev.c b/fs/char_dev.c
index ba0ded7842a7..fc042a0a098f 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -667,6 +667,7 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data)
 void __init chrdev_init(void)
 {
 	cdev_map = kobj_map_init(base_probe, &chrdevs_lock);
+	tty_init();
 }
 
 
-- 
2.20.1.2432.ga663e714


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

end of thread, other threads:[~2022-02-08  7:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-06 16:27 [PATCH] chardev: call tty_init() in real chrdev_init() Xu Yu
2022-02-06 17:03 ` Greg KH
2022-02-07  6:37   ` Yu Xu
2022-02-07  7:14     ` Greg KH
2022-02-08  7:02 ` [chardev] c194b1c9f0: BUG:kernel_NULL_pointer_dereference, address kernel test robot
2022-02-08  7:02   ` [chardev] c194b1c9f0: BUG:kernel_NULL_pointer_dereference,address kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.