staging: dgap: remove unneeded kfree() in dgap_tty_register_ports()

When it failed to allocate for printer_ports, serial_ports
can be freed in dgap_tty_uninit().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Daeseok Youn 2014-05-26 19:24:17 +09:00 committed by Greg Kroah-Hartman
parent 462310f3f3
commit 0ade4a34fd
1 changed files with 2 additions and 3 deletions

View File

@ -4147,10 +4147,9 @@ static int dgap_tty_register_ports(struct board_t *brd)
brd->printer_ports = kcalloc(brd->nasync, sizeof(*brd->printer_ports),
GFP_KERNEL);
if (brd->printer_ports == NULL) {
kfree(brd->serial_ports);
if (brd->printer_ports == NULL)
return -ENOMEM;
}
for (i = 0; i < brd->nasync; i++)
tty_port_init(&brd->printer_ports[i]);