staging: dgap: remove unneeded kfree() in dgap_tty_register_ports()
authorDaeseok Youn <daeseok.youn@gmail.com>
Mon, 26 May 2014 10:24:17 +0000 (19:24 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 May 2014 17:35:24 +0000 (10:35 -0700)
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>
drivers/staging/dgap/dgap.c

index 60b7d700b07d11a55dfda39b3172c657c16c66f1..06abb20474431c71a24c75de041cd38624067aa1 100644 (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]);