diff mbox series

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

Message ID e66b822b-026b-29cc-e461-6334aafd1d30@web.de (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show
Series clk: renesas: mstp: Delete an unnecessary kfree() call in cpg_mstp_clocks_init() | expand

Commit Message

Markus Elfring Aug. 27, 2019, 1:27 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/renesas/clk-mstp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--
2.23.0

Comments

Geert Uytterhoeven Aug. 27, 2019, 1:31 p.m. UTC | #1
On Tue, Aug 27, 2019 at 3:27 PM Markus Elfring <Markus.Elfring@web.de> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in clk-renesas-for-v5.5.

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c
index 2db9093546c6..09f8894bb91b 100644
--- a/drivers/clk/renesas/clk-mstp.c
+++ b/drivers/clk/renesas/clk-mstp.c
@@ -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);