mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] clk: ti: mux: don't free `parent_names' on kzalloc() failure
@ 2022-10-17 16:46 Dario Binacchi
  2022-10-28  0:41 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Dario Binacchi @ 2022-10-17 16:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Amarula patchwork, michael, Dario Binacchi, Greg Kroah-Hartman,
	Michael Turquette, Stephen Boyd, Tero Kristo, Thomas Gleixner,
	Tony Lindgren, linux-clk, linux-omap

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

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

---

 drivers/clk/ti/mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/ti/mux.c b/drivers/clk/ti/mux.c
index 46b45b3e8319..1f924db2ad98 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);
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] clk: ti: mux: don't free `parent_names' on kzalloc() failure
  2022-10-17 16:46 [PATCH] clk: ti: mux: don't free `parent_names' on kzalloc() failure Dario Binacchi
@ 2022-10-28  0:41 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2022-10-28  0:41 UTC (permalink / raw)
  To: Dario Binacchi, linux-kernel
  Cc: Amarula patchwork, michael, Dario Binacchi, Greg Kroah-Hartman,
	Michael Turquette, Tero Kristo, Thomas Gleixner, Tony Lindgren,
	linux-clk, linux-omap

Quoting Dario Binacchi (2022-10-17 09:46:46)
> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-28  0:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17 16:46 [PATCH] clk: ti: mux: don't free `parent_names' on kzalloc() failure Dario Binacchi
2022-10-28  0:41 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®