Skip to content

Commit

Permalink
ep93xx: clock: Do not return the address of the freed memory
Browse files Browse the repository at this point in the history
Avoid return freed memory addresses,Modified to the actual error
return value of clk_register().

Fixes: 9645ccc ("ep93xx: clock: convert in-place to COMMON_CLK")
Signed-off-by: Genjian Zhang <[email protected]>
Acked-by: Alexander Sverdlin <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
  • Loading branch information
Genjian Zhang authored and arndb committed May 27, 2022
1 parent 3e11194 commit 8a7322a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions arch/arm/mach-ep93xx/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,10 @@ static struct clk_hw *clk_hw_register_ddiv(const char *name,
psc->hw.init = &init;

clk = clk_register(NULL, &psc->hw);
if (IS_ERR(clk))
if (IS_ERR(clk)) {
kfree(psc);

return ERR_CAST(clk);
}
return &psc->hw;
}

Expand Down Expand Up @@ -452,9 +453,10 @@ static struct clk_hw *clk_hw_register_div(const char *name,
psc->hw.init = &init;

clk = clk_register(NULL, &psc->hw);
if (IS_ERR(clk))
if (IS_ERR(clk)) {
kfree(psc);

return ERR_CAST(clk);
}
return &psc->hw;
}

Expand Down

0 comments on commit 8a7322a

Please sign in to comment.