diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2013-06-15 07:04:51 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-23 19:38:35 -0400 |
commit | b0e95858238d95f32edf00ff4a0375165129d0c6 (patch) | |
tree | e07bfa8ce5ce73a360cdd0f5185bf8da9433d48d /drivers/tty/tty_ldisc.c | |
parent | e97733ca677878d0ecf08af17f4661eb83e268bc (diff) |
tty: Clarify multiple-references comment in TIOCSETD ioctl
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 | /* |