Skip to contentSkip to conversation

clk: renesas: mstp: Delete an unnecessary kfree() call in cpg_mstp_clocks_init()

PATCH In review Markus Elfring 2 participants 2 messages Aug 27, 2019

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

PATCH 1/1 clk: renesas: mstp: Delete an unnecessary kfree() call in cpg_mstp_clocks_init()

From: Markus Elfring <[email protected]>
Date: Tue, 27 Aug 2019 15:22:12 +0200

A null pointer would be passed to a call of the function “kfree” directly after a call of the function “kzalloc” failed at one place. Remove this superfluous function call.

This issue was detected by using the Coccinelle software.

---
 drivers/clk/renesas/clk-mstp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clk/renesas/clk-mstp.c +1 -3
index 2db9093546c6..09f8894bb91b 100644
@@ -189,10 +189,8 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
 	unsigned int i;
 
 	group = kzalloc(struct_size(group, clks, MSTP_MAX_CLOCKS), GFP_KERNEL);
-	if (group == NULL) {
-		kfree(group);
+	if (!group)
 		return;
-	}
 
 	clks = group->clks;
 	spin_lock_init(&group->lock);

--
2.23.0

Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 27 Aug 2019 15:22:12 +0200

A null pointer would be passed to a call of the function “kfree” directly after a call of the function “kzalloc” failed at one place. Remove this superfluous function call.

This issue was detected by using the Coccinelle software.

i.e. will queue in clk-renesas-for-v5.5.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds