diff options
Diffstat (limited to 'drivers/tty/tty_ldisc.c')
-rw-r--r-- | drivers/tty/tty_ldisc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 5819667f5bdb..75fa99978348 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
@@ -570,13 +570,15 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) | |||
570 | tty_ldisc_restore(tty, old_ldisc); | 570 | tty_ldisc_restore(tty, old_ldisc); |
571 | } | 571 | } |
572 | 572 | ||
573 | /* At this point we hold a reference to the new ldisc and a | ||
574 | a reference to the old ldisc. If we ended up flipping back | ||
575 | to the existing ldisc we have two references to it */ | ||
576 | |||
577 | if (tty->ldisc->ops->num != old_ldisc->ops->num && tty->ops->set_ldisc) | 573 | if (tty->ldisc->ops->num != old_ldisc->ops->num && tty->ops->set_ldisc) |
578 | tty->ops->set_ldisc(tty); | 574 | tty->ops->set_ldisc(tty); |
579 | 575 | ||
576 | /* At this point we hold a reference to the new ldisc and a | ||
577 | reference to the old ldisc, or we hold two references to | ||
578 | the old ldisc (if it was restored as part of error cleanup | ||
579 | above). In either case, releasing a single reference from | ||
580 | the old ldisc is correct. */ | ||
581 | |||
580 | tty_ldisc_put(old_ldisc); | 582 | tty_ldisc_put(old_ldisc); |
581 | 583 | ||
582 | /* | 584 | /* |