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>
This commit is contained in:
parent
0ade4a34fd
commit
a66369a590
1 changed files with 3 additions and 3 deletions
|
@ -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]) {
|
||||
|
|
Loading…
Reference in a new issue