From 732d32be09e2a9bbe6e648e31482eedb0c0c10b7 Mon Sep 17 00:00:00 2001 From: Shell Date: Fri, 19 Apr 2024 10:59:21 +0800 Subject: [PATCH] [smart] fixup rt_hw_serial_unregister_tty of serial tty Mutex lock should be taken before release the TTY device. Signed-off-by: Shell --- components/drivers/serial/serial_tty.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/drivers/serial/serial_tty.c b/components/drivers/serial/serial_tty.c index 1443cd1632..a4c3dbbe41 100644 --- a/components/drivers/serial/serial_tty.c +++ b/components/drivers/serial/serial_tty.c @@ -358,6 +358,8 @@ rt_err_t rt_hw_serial_unregister_tty(struct rt_serial_device *serial) softc = tty_softc(tp); serial->rx_notify = softc->backup_notify; + tty_lock(tp); + tty_rel_gone(tp); /* device unregister? */