Linux IA64 platform development
 help / color / mirror / Atom feed
* [PATCH] serial: ioc3_serial: release resources in error return path
@ 2010-09-29  4:53 Rahul Ruikar
  2010-10-01 20:47 ` Tony Luck
  0 siblings, 1 reply; 2+ messages in thread
From: Rahul Ruikar @ 2010-09-29  4:53 UTC (permalink / raw)
  To: Pat Gefre, Greg Kroah-Hartman, Alan Cox, Andrew Morton, Tejun Heo
  Cc: linux-mips, linux-ia64, linux-kernel, Rahul Ruikar

In ioc3uart_probe()
resources were not released during error return path
- ports[phys_port]

Signed-off-by: Rahul Ruikar <rahul.ruikar@gmail.com>
---
 drivers/serial/ioc3_serial.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c
index 93de907..1a182cf 100644
--- a/drivers/serial/ioc3_serial.c
+++ b/drivers/serial/ioc3_serial.c
@@ -2017,6 +2017,7 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
 	struct ioc3_port *port;
 	struct ioc3_port *ports[PORTS_PER_CARD];
 	int phys_port;
+	int cnt;
 
 	DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __func__, is, idd));
 
@@ -2044,7 +2045,7 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
 		if (!port) {
 			printk(KERN_WARNING
 			       "IOC3 serial memory not available for port\n");
-			goto out4;
+			goto out3;
 		}
 		spin_lock_init(&port->ip_lock);
 
@@ -2138,13 +2139,16 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
 	/* register port with the serial core */
 
 	if ((ret = ioc3_serial_core_attach(is, idd)))
-		goto out4;
+		goto out3;
 
 	Num_of_ioc3_cards++;
 
 	return ret;
 
 	/* error exits that give back resources */
+out3:
+	for (cnt = 0; cnt < phys_port; cnt++)
+		kfree(ports[cnt]);
 out4:
 	kfree(card_ptr);
 	return ret;
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-01 20:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-29  4:53 [PATCH] serial: ioc3_serial: release resources in error return path Rahul Ruikar
2010-10-01 20:47 ` Tony Luck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox