tty: Avoid unnecessary temporaries for tty->ldisc
authorPeter Hurley <peter@hurleysoftware.com>
Mon, 11 Jan 2016 06:41:08 +0000 (22:41 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jan 2016 23:01:44 +0000 (15:01 -0800)
tty_ldisc_setup() is race-free and can reference tty->ldisc without
snapshots.

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

index c6f970d..4cb5e57 100644 (file)
@@ -752,17 +752,14 @@ void tty_ldisc_hangup(struct tty_struct *tty, bool reinit)
 
 int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty)
 {
-       struct tty_ldisc *ld = tty->ldisc;
-       int retval;
-
-       retval = tty_ldisc_open(tty, ld);
+       int retval = tty_ldisc_open(tty, tty->ldisc);
        if (retval)
                return retval;
 
        if (o_tty) {
                retval = tty_ldisc_open(o_tty, o_tty->ldisc);
                if (retval) {
-                       tty_ldisc_close(tty, ld);
+                       tty_ldisc_close(tty, tty->ldisc);
                        return retval;
                }
        }