Custom Search

[PATCH] serial: ioc3_serial: release resources in error return path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

Signed-off-by: Rahul Ruikar <rahul.ruikar@xxxxxxxxx>
 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) {
 			       "IOC3 serial memory not available for port\n");
-			goto out4;
+			goto out3;
@@ -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;
 	return ret;
 	/* error exits that give back resources */
+	for (cnt = 0; cnt < phys_port; cnt++)
+		kfree(ports[cnt]);
 	return ret;

To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at

[Index of Archives]     [Linux Kernel]     [Sparc Linux]     [DCCP]     [Linux ARM]     [Linux]     [Photo]     [Yosemite News]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux