Commit 0ade4a34 authored by Daeseok Youn's avatar Daeseok Youn Committed by Greg Kroah-Hartman

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: default avatarDaeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 462310f3
......@@ -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]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment