Revert "staging: dgap: remove unneeded kfree() in dgap_tty_register_ports()"
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2014 20:59:03 +0000 (13:59 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2014 20:59:03 +0000 (13:59 -0700)
This reverts commit 0ade4a34fd439d62df46937e8f3e584eb0879579 as it was
wrong.

Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dgap/dgap.c

index 48c13c9..170d6f3 100644 (file)
@@ -4145,8 +4145,10 @@ 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)
+       if (!brd->printer_ports) {
+               kfree(brd->serial_ports);
                return -ENOMEM;
+       }
 
        for (i = 0; i < brd->nasync; i++) {
                tty_port_init(&brd->serial_ports[i]);