aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/dgap
diff options
context:
space:
mode:
authorDaeseok Youn <daeseok.youn@gmail.com>2014-05-26 19:24:47 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-26 10:35:25 -0700
commita66369a59016e6f5c5da77afbd53eec49b03fb68 (patch)
treef030f38003d556c066551abcac4aeee17d02b7f4 /drivers/staging/dgap
parent0ade4a34fd439d62df46937e8f3e584eb0879579 (diff)
downloadlinux-stericsson-a66369a59016e6f5c5da77afbd53eec49b03fb68.tar.gz
staging: dgap: move tty_port_init() for serial_ports.
If printer_ports which is allocated after serial_ports is failed to allocate, tty_port_init for serial_ports doesn't need anymore. So move this after allocating memory for printer_ports. Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/dgap')
-rw-r--r--drivers/staging/dgap/dgap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 06abb2047443..65d651ed7117 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -4142,16 +4142,16 @@ static int dgap_tty_register_ports(struct board_t *brd)
GFP_KERNEL);
if (brd->serial_ports == NULL)
return -ENOMEM;
- for (i = 0; i < brd->nasync; i++)
- tty_port_init(&brd->serial_ports[i]);
brd->printer_ports = kcalloc(brd->nasync, sizeof(*brd->printer_ports),
GFP_KERNEL);
if (brd->printer_ports == NULL)
return -ENOMEM;
- for (i = 0; i < brd->nasync; i++)
+ for (i = 0; i < brd->nasync; i++) {
+ tty_port_init(&brd->serial_ports[i]);
tty_port_init(&brd->printer_ports[i]);
+ }
ch = brd->channels[0];
for (i = 0; i < brd->nasync; i++, ch = brd->channels[i]) {