diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 12:23:20 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 12:23:20 -0700 |
commit | 99dff5856220a02b8711f2e8746413ea6e53ccf6 (patch) | |
tree | d8bae7ccdf8f7ad5221b053bb74a6220df996b3a /drivers/tty/pty.c | |
parent | bb74e8ca352eecefdc5c1a9ebab01f18aa2f6f3c (diff) | |
parent | d9a0fbfd7bc5d2c42f0fa9bcbdab62c4942d0388 (diff) | |
download | op-kernel-dev-99dff5856220a02b8711f2e8746413ea6e53ccf6.zip op-kernel-dev-99dff5856220a02b8711f2e8746413ea6e53ccf6.tar.gz |
Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (48 commits)
serial: 8250_pci: add support for Cronyx Omega PCI multiserial board.
tty/serial: Fix break handling for PORT_TEGRA
tty/serial: Add explicit PORT_TEGRA type
n_tracerouter and n_tracesink ldisc additions.
Intel PTI implementaiton of MIPI 1149.7.
Kernel documentation for the PTI feature.
export kernel call get_task_comm().
tty: Remove to support serial for S5P6442
pch_phub: Support new device ML7223
8250_pci: Add support for the Digi/IBM PCIe 2-port Adapter
ASoC: Update cx20442 for TTY API change
pch_uart: Support new device ML7223 IOH
parport: Use request_muxed_region for IT87 probe and lock
tty/serial: add support for Xilinx PS UART
n_gsm: Use print_hex_dump_bytes
drivers/tty/moxa.c: Put correct tty value
TTY: tty_io, annotate locking functions
TTY: serial_core, remove superfluous set_task_state
TTY: serial_core, remove invalid test
Char: moxa, fix locking in moxa_write
...
Fix up trivial conflicts in drivers/bluetooth/hci_ldisc.c and
drivers/tty/serial/Makefile.
I did the hci_ldisc thing as an evil merge, cleaning things up.
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r-- | drivers/tty/pty.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 2107747..98b6e3b 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -1,6 +1,4 @@ /* - * linux/drivers/char/pty.c - * * Copyright (C) 1991, 1992 Linus Torvalds * * Added support for a Unix98-style ptmx device. @@ -295,8 +293,8 @@ static int pty_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; + retval = -ENOMEM; + goto err_free_tty; } initialize_tty_struct(o_tty, driver->other, idx); @@ -304,13 +302,11 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty) the easy way .. */ retval = tty_init_termios(tty); if (retval) - goto free_mem_out; + goto err_deinit_tty; retval = tty_init_termios(o_tty); - if (retval) { - tty_free_termios(tty); - goto free_mem_out; - } + if (retval) + goto err_free_termios; /* * Everything allocated ... set up the o_tty structure. @@ -327,10 +323,14 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty) tty->count++; driver->ttys[idx] = tty; return 0; -free_mem_out: +err_free_termios: + tty_free_termios(tty); +err_deinit_tty: + deinitialize_tty_struct(o_tty); module_put(o_tty->driver->owner); +err_free_tty: free_tty_struct(o_tty); - return -ENOMEM; + return retval; } static int pty_bsd_ioctl(struct tty_struct *tty, @@ -559,20 +559,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; @@ -591,11 +590,13 @@ 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: + deinitialize_tty_struct(o_tty); 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; } |