mirror of https://gitee.com/openkylin/linux.git
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:
parent
462310f3f3
commit
0ade4a34fd
|
@ -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]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue