Browse Source

Revert "staging: dgap: remove unneeded kfree() in dgap_tty_register_ports()"

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>
Greg Kroah-Hartman 11 years ago
parent
commit
aec46bbdea
1 changed files with 3 additions and 1 deletions
  1. 3 1
      drivers/staging/dgap/dgap.c

+ 3 - 1
drivers/staging/dgap/dgap.c

@@ -4145,8 +4145,10 @@ static int dgap_tty_register_ports(struct board_t *brd)
 
 
 	brd->printer_ports = kcalloc(brd->nasync, sizeof(*brd->printer_ports),
 	brd->printer_ports = kcalloc(brd->nasync, sizeof(*brd->printer_ports),
 					GFP_KERNEL);
 					GFP_KERNEL);
-	if (!brd->printer_ports)
+	if (!brd->printer_ports) {
+		kfree(brd->serial_ports);
 		return -ENOMEM;
 		return -ENOMEM;
+	}
 
 
 	for (i = 0; i < brd->nasync; i++) {
 	for (i = 0; i < brd->nasync; i++) {
 		tty_port_init(&brd->serial_ports[i]);
 		tty_port_init(&brd->serial_ports[i]);