Browse Source

[smart] fixup rt_hw_serial_unregister_tty of serial tty

Mutex lock should be taken before release the TTY device.

Signed-off-by: Shell <smokewood@qq.com>
Shell 1 year ago
parent
commit
732d32be09
1 changed files with 2 additions and 0 deletions
  1. 2 0
      components/drivers/serial/serial_tty.c

+ 2 - 0
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);
     softc = tty_softc(tp);
     serial->rx_notify = softc->backup_notify;
     serial->rx_notify = softc->backup_notify;
 
 
+    tty_lock(tp);
+
     tty_rel_gone(tp);
     tty_rel_gone(tp);
 
 
     /* device unregister? */
     /* device unregister? */