[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140529070127.GA1347@devel.8.8.4.4>
Date: Thu, 29 May 2014 16:01:27 +0900
From: Daeseok Youn <daeseok.youn@...il.com>
To: lidza.louina@...il.com, gregkh@...uxfoundation.org
Cc: markh@...pro.net, dan.carpenter@...cle.com,
driverdev-devel@...uxdriverproject.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] Revert "staging: dgap: remove unneeded kfree() in
dgap_tty_register_ports()"
This reverts commit 0ade4a34fd439d62df46937e8f3e584eb0879579.
This patch removes kfree for serial_ports in dgap_tty_register_ports()
if the "brd->printer_ports" allocation fails and serial_ports may be
freed by calling dgap_tty_uninit() within other patch.
That patch has an error handling but incomplete cleanup
so it need to call kfree() for brd->serial_ports in
dgap_tty_register_ports().
Conflicts:
drivers/staging/dgap/dgap.c
---
drivers/staging/dgap/dgap.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 48c13c9..f0556ee 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/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),
GFP_KERNEL);
- if (!brd->printer_ports)
+ if (brd->printer_ports == NULL) {
+ kfree(brd->serial_ports);
return -ENOMEM;
+ }
for (i = 0; i < brd->nasync; i++) {
tty_port_init(&brd->serial_ports[i]);
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists