Skip to content

Commit

Permalink
clk: renesas: mstp: Delete unnecessary kfree() in cpg_mstp_clocks_init()
Browse files Browse the repository at this point in the history
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>
Link: https://lore.kernel.org/r/e66b822b-026b-29cc-e461-6334aafd1d30@web.de
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
  • Loading branch information
Markus Elfring authored and Geert Uytterhoeven committed Oct 1, 2019
1 parent 54ce17d commit ba28236
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/clk/renesas/clk-mstp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ba28236

Please sign in to comment.