diff options
author | Jiri Slaby <jslaby@suse.cz> | 2011-03-23 05:48:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-19 17:43:00 -0400 |
commit | c18d77aa00cde1215d9e045ba8f93004fe843f38 (patch) | |
tree | d31768d04e2cbda73df242e6a9445a9ab62956a8 /drivers/tty/pty.c | |
parent | 8a1b8d70a07628f294f30485acf81971e3fcc755 (diff) |
TTY: unify pty_unix98_install fail path handling
Change it so that we call the deinit functions at one place at the end
of the function (by gotos). And while at it use some sane label names.
This is a preparation for the deinitialization of tty in the next
patch.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r-- | drivers/tty/pty.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index f5119184259c..b25d6c4014a5 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
@@ -560,20 +560,19 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) | |||
560 | return -ENOMEM; | 560 | return -ENOMEM; |
561 | if (!try_module_get(driver->other->owner)) { | 561 | if (!try_module_get(driver->other->owner)) { |
562 | /* This cannot in fact currently happen */ | 562 | /* This cannot in fact currently happen */ |
563 | free_tty_struct(o_tty); | 563 | goto err_free_tty; |
564 | return -ENOMEM; | ||
565 | } | 564 | } |
566 | initialize_tty_struct(o_tty, driver->other, idx); | 565 | initialize_tty_struct(o_tty, driver->other, idx); |
567 | 566 | ||
568 | tty->termios = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL); | 567 | tty->termios = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL); |
569 | if (tty->termios == NULL) | 568 | if (tty->termios == NULL) |
570 | goto free_mem_out; | 569 | goto err_free_mem; |
571 | *tty->termios = driver->init_termios; | 570 | *tty->termios = driver->init_termios; |
572 | tty->termios_locked = tty->termios + 1; | 571 | tty->termios_locked = tty->termios + 1; |
573 | 572 | ||
574 | o_tty->termios = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL); | 573 | o_tty->termios = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL); |
575 | if (o_tty->termios == NULL) | 574 | if (o_tty->termios == NULL) |
576 | goto free_mem_out; | 575 | goto err_free_mem; |
577 | *o_tty->termios = driver->other->init_termios; | 576 | *o_tty->termios = driver->other->init_termios; |
578 | o_tty->termios_locked = o_tty->termios + 1; | 577 | o_tty->termios_locked = o_tty->termios + 1; |
579 | 578 | ||
@@ -592,11 +591,12 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) | |||
592 | tty->count++; | 591 | tty->count++; |
593 | pty_count++; | 592 | pty_count++; |
594 | return 0; | 593 | return 0; |
595 | free_mem_out: | 594 | err_free_mem: |
596 | kfree(o_tty->termios); | 595 | kfree(o_tty->termios); |
596 | kfree(tty->termios); | ||
597 | module_put(o_tty->driver->owner); | 597 | module_put(o_tty->driver->owner); |
598 | err_free_tty: | ||
598 | free_tty_struct(o_tty); | 599 | free_tty_struct(o_tty); |
599 | kfree(tty->termios); | ||
600 | return -ENOMEM; | 600 | return -ENOMEM; |
601 | } | 601 | } |
602 | 602 | ||