summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2020-08-09 18:11:58 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-29 09:05:40 +0100
commit4e504a73adfdabf322e83bcc428804d78ca6ab48 (patch)
treed405b70dcb48d6c68f4a0f1aead626ba397667d2
parent66a761e47319b61863845b28f7d9a1da6595d94e (diff)
downloadlinux-stable-4e504a73adfdabf322e83bcc428804d78ca6ab48.tar.gz
linux-stable-4e504a73adfdabf322e83bcc428804d78ca6ab48.tar.bz2
linux-stable-4e504a73adfdabf322e83bcc428804d78ca6ab48.zip
clk: bcm2835: add missing release if devm_clk_hw_register fails
[ Upstream commit f6c992ca7dd4f49042eec61f3fb426c94d901675 ] In the implementation of bcm2835_register_pll(), the allocated pll is leaked if devm_clk_hw_register() fails to register hw. Release pll if devm_clk_hw_register() fails. Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Link: https://lore.kernel.org/r/20200809231202.15811-1-navid.emamdoost@gmail.com Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the audio domain clocks") Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/clk/bcm/clk-bcm2835.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 2b5075298cdc..3f16b553982d 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -1177,8 +1177,10 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman,
pll->hw.init = &init;
ret = devm_clk_hw_register(cprman->dev, &pll->hw);
- if (ret)
+ if (ret) {
+ kfree(pll);
return NULL;
+ }
return &pll->hw;
}