diff mbox series

[1/2] powerpc/powernv/vas: One function call less in vas_window_alloc() after error detection

Message ID 1f1c21cf-c34c-418c-b00c-8e6474f12612@web.de (mailing list archive)
State Rejected
Headers show
Series powerpc/powernv/vas: Adjustments for two function implementations | expand

Commit Message

Markus Elfring Dec. 23, 2023, 7:20 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 23 Dec 2023 19:35:13 +0100

The kfree() function was called in one case by the
vas_window_alloc() function during error handling
even if the passed variable contained a null pointer.
This issue was detected by using the Coccinelle software.

Thus use another label.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/powerpc/platforms/powernv/vas-window.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.43.0
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c
index b664838008c1..b51219b4b698 100644
--- a/arch/powerpc/platforms/powernv/vas-window.c
+++ b/arch/powerpc/platforms/powernv/vas-window.c
@@ -545,7 +545,7 @@  static struct pnv_vas_window *vas_window_alloc(struct vas_instance *vinst)

 	window = kzalloc(sizeof(*window), GFP_KERNEL);
 	if (!window)
-		goto out_free;
+		goto release_window_id;

 	window->vinst = vinst;
 	window->vas_win.winid = winid;
@@ -559,6 +559,7 @@  static struct pnv_vas_window *vas_window_alloc(struct vas_instance *vinst)

 out_free:
 	kfree(window);
+release_window_id:
 	vas_release_window_id(&vinst->ida, winid);
 	return ERR_PTR(-ENOMEM);
 }