Skip to content

Commit

Permalink
!12812 serial: protect uart_port_dtr_rts() in uart_shutdown() too
Browse files Browse the repository at this point in the history
Merge Pull Request from: @ci-robot 
 
PR sync from: Yi Yang <yiyang13@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/UOP7OZ3WBF4D7KS7ZBG5RUCZNRRE5FDD/ 
 
https://gitee.com/src-openeuler/kernel/issues/IAYREU 
 
Link:https://gitee.com/openeuler/kernel/pulls/12812 

Reviewed-by: Yang Yingliang <yangyingliang@huawei.com> 
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
  • Loading branch information
openeuler-ci-bot authored and gitee-org committed Nov 3, 2024
2 parents 4f5b3a4 + 2fd4f20 commit 170b758
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions drivers/tty/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,16 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
/*
* Turn off DTR and RTS early.
*/
if (uport && uart_console(uport) && tty) {
uport->cons->cflag = tty->termios.c_cflag;
uport->cons->ispeed = tty->termios.c_ispeed;
uport->cons->ospeed = tty->termios.c_ospeed;
}
if (uport) {
if (uart_console(uport) && tty) {
uport->cons->cflag = tty->termios.c_cflag;
uport->cons->ispeed = tty->termios.c_ispeed;
uport->cons->ospeed = tty->termios.c_ospeed;
}

if (!tty || C_HUPCL(tty))
uart_port_dtr_rts(uport, 0);
if (!tty || C_HUPCL(tty))
uart_port_dtr_rts(uport, 0);
}

uart_port_shutdown(port);
}
Expand Down

0 comments on commit 170b758

Please sign in to comment.