Skip to contentSkip to conversation

clk: ti: mux: don't free `parent_names' on kzalloc() failure

PATCH In review Dario Binacchi 2 participants 2 messages Oct 17, 2022 – Oct 28, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: ti: mux: don't free `parent_names' on kzalloc() failure

Although no operation is performed by kfree() on a NULL pointer, it's however suboptimal and semantically wrong doing it.

---

 drivers/clk/ti/mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/ti/mux.c +1 -1
index 46b45b3e8319..1f924db2ad98 100644
@@ -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);
 
Signature · 1 line
2.32.0
maintainer
#1 lore raw

Quoting Dario Binacchi (2022-10-17 09:46:46)

Quoted 2 lines

Although no operation is performed by kfree() on a NULL pointer, it's however suboptimal and semantically wrong doing it.

Passing NULL to kfree() is fine. This is trying to optimize an error path as well. No thanks.