raw/cnxk_gpio: fix resource leak

Message ID 20231107095946.3227242-1-tduszynski@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series raw/cnxk_gpio: fix resource leak |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Tomasz Duszynski Nov. 7, 2023, 9:59 a.m. UTC
  Fix resource leak.

Coverity issue: 405118
Fixes: ef2a3f3b4c9e ("raw/cnxk_gpio: support multi-process")

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
---
 drivers/raw/cnxk_gpio/cnxk_gpio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Jerin Jacob Nov. 7, 2023, 1:52 p.m. UTC | #1
On Tue, Nov 7, 2023 at 3:30 PM Tomasz Duszynski <tduszynski@marvell.com> wrote:
>
> Fix resource leak.
>
> Coverity issue: 405118
> Fixes: ef2a3f3b4c9e ("raw/cnxk_gpio: support multi-process")
>
> Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>

Applied to dpdk-next-net-mrvl/for-next-net. Thanks
  

Patch

diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio.c b/drivers/raw/cnxk_gpio/cnxk_gpio.c
index ebc914afcf..45e2ab5e00 100644
--- a/drivers/raw/cnxk_gpio/cnxk_gpio.c
+++ b/drivers/raw/cnxk_gpio/cnxk_gpio.c
@@ -171,8 +171,10 @@  cnxk_gpio_parse_store_args(struct cnxk_gpio_params **params, const char *args)
 		len += strlen(allowlist) + 1;
 
 	*params = cnxk_gpio_params_reserve(len);
-	if (!(*params))
-		return -ENOMEM;
+	if (!(*params)) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
 	strlcpy((*params)->allowlist, allowlist, strlen(allowlist) + 1);