diff mbox series

[06/10] clk: ti: Return directly after a failed kzalloc() in of_mux_clk_setup()

Message ID 769d269c-126f-477e-a046-d00dcf918829@web.de (mailing list archive)
State Changes Requested, archived
Headers show
Series clk: ti: Adjustments for eight function implementations | expand

Commit Message

Markus Elfring Dec. 24, 2023, 4:45 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 24 Dec 2023 14:20:18 +0100

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

Thus return directly after a call of the function “kzalloc” failed
at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/ti/mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.43.0
diff mbox series

Patch

diff --git a/drivers/clk/ti/mux.c b/drivers/clk/ti/mux.c
index 1ebafa386be6..ab1205fa40d6 100644
--- a/drivers/clk/ti/mux.c
+++ b/drivers/clk/ti/mux.c
@@ -182,7 +182,7 @@  static void of_mux_clk_setup(struct device_node *node)
 	}
 	parent_names = kzalloc((sizeof(char *) * num_parents), GFP_KERNEL);
 	if (!parent_names)
-		goto cleanup;
+		return;

 	of_clk_parent_fill(node, parent_names, num_parents);