diff options
author | Jiri Slaby <jslaby@suse.cz> | 2011-03-23 09:48:34 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-19 21:43:00 (GMT) |
commit | c18d77aa00cde1215d9e045ba8f93004fe843f38 (patch) | |
tree | d31768d04e2cbda73df242e6a9445a9ab62956a8 /drivers | |
parent | 8a1b8d70a07628f294f30485acf81971e3fcc755 (diff) | |
download | linux-fsl-qoriq-c18d77aa00cde1215d9e045ba8f93004fe843f38.tar.xz |
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')
-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 f511918..b25d6c4 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) return -ENOMEM; if (!try_module_get(driver->other->owner)) { /* This cannot in fact currently happen */ - free_tty_struct(o_tty); - return -ENOMEM; + goto err_free_tty; } initialize_tty_struct(o_tty, driver->other, idx); tty->termios = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL); if (tty->termios == NULL) - goto free_mem_out; + goto err_free_mem; *tty->termios = driver->init_termios; tty->termios_locked = tty->termios + 1; o_tty->termios = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL); if (o_tty->termios == NULL) - goto free_mem_out; + goto err_free_mem; *o_tty->termios = driver->other->init_termios; o_tty->termios_locked = o_tty->termios + 1; @@ -592,11 +591,12 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) tty->count++; pty_count++; return 0; -free_mem_out: +err_free_mem: kfree(o_tty->termios); + kfree(tty->termios); module_put(o_tty->driver->owner); +err_free_tty: free_tty_struct(o_tty); - kfree(tty->termios); return -ENOMEM; } |