diff options
| -rw-r--r-- | drivers/tty/serial/serial_core.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 765be520cd2e..6ce40c1822fc 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
| @@ -2723,15 +2723,15 @@ EXPORT_SYMBOL(uart_match_port); | |||
| 2723 | */ | 2723 | */ |
| 2724 | void uart_handle_dcd_change(struct uart_port *uport, unsigned int status) | 2724 | void uart_handle_dcd_change(struct uart_port *uport, unsigned int status) |
| 2725 | { | 2725 | { |
| 2726 | struct uart_state *state = uport->state; | 2726 | struct tty_port *port = &uport->state->port; |
| 2727 | struct tty_port *port = &state->port; | ||
| 2728 | struct tty_ldisc *ld = NULL; | ||
| 2729 | struct tty_struct *tty = port->tty; | 2727 | struct tty_struct *tty = port->tty; |
| 2728 | struct tty_ldisc *ld = tty ? tty_ldisc_ref(tty) : NULL; | ||
| 2730 | 2729 | ||
| 2731 | if (tty) | 2730 | if (ld) { |
| 2732 | ld = tty_ldisc_ref(tty); | 2731 | if (ld->ops->dcd_change) |
| 2733 | if (ld && ld->ops->dcd_change) | 2732 | ld->ops->dcd_change(tty, status); |
| 2734 | ld->ops->dcd_change(tty, status); | 2733 | tty_ldisc_deref(ld); |
| 2734 | } | ||
| 2735 | 2735 | ||
| 2736 | uport->icount.dcd++; | 2736 | uport->icount.dcd++; |
| 2737 | #ifdef CONFIG_HARD_PPS | 2737 | #ifdef CONFIG_HARD_PPS |
| @@ -2745,9 +2745,6 @@ void uart_handle_dcd_change(struct uart_port *uport, unsigned int status) | |||
| 2745 | else if (tty) | 2745 | else if (tty) |
| 2746 | tty_hangup(tty); | 2746 | tty_hangup(tty); |
| 2747 | } | 2747 | } |
| 2748 | |||
| 2749 | if (ld) | ||
| 2750 | tty_ldisc_deref(ld); | ||
| 2751 | } | 2748 | } |
| 2752 | EXPORT_SYMBOL_GPL(uart_handle_dcd_change); | 2749 | EXPORT_SYMBOL_GPL(uart_handle_dcd_change); |
| 2753 | 2750 | ||
