diff mbox series

[v2,1/8] bus/dpaa: fix the resource leak issue

Message ID 1523269371-28799-1-git-send-email-hemant.agrawal@nxp.com
State New
Headers show
Series [v2,1/8] bus/dpaa: fix the resource leak issue | expand

Commit Message

Hemant Agrawal April 9, 2018, 10:22 a.m. UTC
From: Sunil Kumar Kori <sunil.kori@nxp.com>


Fixes: 9d32ef0f5d61 ("bus/dpaa: support creating dynamic HW portal")
Coverity issue: 268332
Cc: stable@dpdk.org

Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 drivers/bus/dpaa/base/qbman/qman_driver.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.7.4

Comments

Thomas Monjalon April 11, 2018, 10:20 p.m. UTC | #1
09/04/2018 12:22, Hemant Agrawal:
> From: Sunil Kumar Kori <sunil.kori@nxp.com>

> 

> Fixes: 9d32ef0f5d61 ("bus/dpaa: support creating dynamic HW portal")

> Coverity issue: 268332

> Cc: stable@dpdk.org

> 

> Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>

> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>


Series applied, thanks
diff mbox series

Patch

diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c
index 66838d2..07b29d5 100644
--- a/drivers/bus/dpaa/base/qbman/qman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/qman_driver.c
@@ -160,6 +160,7 @@  struct qman_portal *fsl_qman_portal_create(void)
 				     &cpuset);
 	if (ret) {
 		error(0, ret, "pthread_getaffinity_np()");
+		kfree(q_pcfg);
 		return NULL;
 	}
 
@@ -168,12 +169,14 @@  struct qman_portal *fsl_qman_portal_create(void)
 		if (CPU_ISSET(loop, &cpuset)) {
 			if (q_pcfg->cpu != -1) {
 				pr_err("Thread is not affine to 1 cpu\n");
+				kfree(q_pcfg);
 				return NULL;
 			}
 			q_pcfg->cpu = loop;
 		}
 	if (q_pcfg->cpu == -1) {
 		pr_err("Bug in getaffinity handling!\n");
+		kfree(q_pcfg);
 		return NULL;
 	}
 
@@ -183,6 +186,7 @@  struct qman_portal *fsl_qman_portal_create(void)
 	ret = process_portal_map(&q_map);
 	if (ret) {
 		error(0, ret, "process_portal_map()");
+		kfree(q_pcfg);
 		return NULL;
 	}
 	q_pcfg->channel = q_map.channel;
@@ -217,6 +221,7 @@  struct qman_portal *fsl_qman_portal_create(void)
 	close(q_fd);
 err1:
 	process_portal_unmap(&q_map.addr);
+	kfree(q_pcfg);
 	return NULL;
 }