提交 0ade4a34 编写于 作者: D Daeseok Youn 提交者: 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: NDaeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册