Commit 8a7322a3 authored by Genjian Zhang's avatar Genjian Zhang Committed by Arnd Bergmann

ep93xx: clock: Do not return the address of the freed memory

Avoid return freed memory addresses,Modified to the actual error
return value of clk_register().

Fixes: 9645ccc7 ("ep93xx: clock: convert in-place to COMMON_CLK")
Signed-off-by: default avatarGenjian Zhang <zhanggenjian@kylinos.cn>
Acked-by: default avatarAlexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 3e111946
......@@ -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;
}
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment