Skip to content

Commit

Permalink
clk: tegra: Fix double-free in tegra_clk_init()
Browse files Browse the repository at this point in the history
It's unlikely to happen in practice ever, but makes static checkers happy.

Fixes: 535f296 ("clk: tegra: Add suspend and resume support on Tegra210")
Reported-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lkml.kernel.org/r/20191210020512.6088-1-digetx@gmail.com
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
  • Loading branch information
Dmitry Osipenko authored and Stephen Boyd committed Dec 24, 2019
1 parent 67f96ff commit fc66693
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/clk/tegra/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,10 @@ struct clk ** __init tegra_clk_init(void __iomem *regs, int num, int banks)
periph_banks = banks;

clks = kcalloc(num, sizeof(struct clk *), GFP_KERNEL);
if (!clks)
if (!clks) {
kfree(periph_clk_enb_refcnt);
return NULL;
}

clk_num = num;

Expand Down

0 comments on commit fc66693

Please sign in to comment.