serial: core: Unwrap tertiary assignment in uart_handle_dcd_change()
authorPeter Hurley <peter@hurleysoftware.com>
Tue, 2 Sep 2014 21:39:21 +0000 (17:39 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Sep 2014 23:23:36 +0000 (16:23 -0700)
Prepare for spin lock assertion; move non-trivial assignment into
function body.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/serial_core.c

index bdc543caf069a6f4a4d1dfa18f7309d44f15e02b..5a78f6940760255d4d197b20486fa1de30e962ac 100644 (file)
@@ -2748,12 +2748,15 @@ void uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
 {
        struct tty_port *port = &uport->state->port;
        struct tty_struct *tty = port->tty;
-       struct tty_ldisc *ld = tty ? tty_ldisc_ref(tty) : NULL;
+       struct tty_ldisc *ld;
 
-       if (ld) {
-               if (ld->ops->dcd_change)
-                       ld->ops->dcd_change(tty, status);
-               tty_ldisc_deref(ld);
+       if (tty) {
+               ld = tty_ldisc_ref(tty);
+               if (ld) {
+                       if (ld->ops->dcd_change)
+                               ld->ops->dcd_change(tty, status);
+                       tty_ldisc_deref(ld);
+               }
        }
 
        uport->icount.dcd++;