summaryrefslogtreecommitdiff
path: root/sound/soc/sh
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-05-27 11:40:22 +0900
committerMark Brown <broonie@kernel.org>2021-05-27 11:15:26 +0100
commit965386c97616c401b34cba4e9e3bfc9c6b215359 (patch)
tree84cff44a034e6496efd756d4f548ee9e2983b075 /sound/soc/sh
parent058efb40641845432c52777443b3372dbc97c032 (diff)
ASoC: rsnd: call unregister for null_hw when removed
commit d6956a7dde6fb ("ASoC: rsnd: add null CLOCKIN support") added null_clk, but it is using local static valuable. It will be leaked if rsnd driver was removed. This patch moves it to priv, and call unregister when removing. Fixes: d6956a7dde6fb ("ASoC: rsnd: add null CLOCKIN support") Link: https://lore.kernel.org/r/87tumsoe2p.wl-kuninori.morimoto.gx@renesas.com Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Message-Id: <877djknbl5.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sh')
-rw-r--r--sound/soc/sh/rcar/adg.c9
-rw-r--r--sound/soc/sh/rcar/rsnd.h1
2 files changed, 6 insertions, 4 deletions
diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index e13eb201d550..774a72a7b6a2 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -392,10 +392,9 @@ void rsnd_adg_clk_control(struct rsnd_priv *priv, int enable)
#define NULL_CLK "rsnd_adg_null"
static struct clk *rsnd_adg_null_clk_get(struct rsnd_priv *priv)
{
- static struct clk_hw *hw;
struct device *dev = rsnd_priv_to_dev(priv);
- if (!hw) {
+ if (!priv->null_hw) {
struct clk_hw *_hw;
int ret;
@@ -407,10 +406,10 @@ static struct clk *rsnd_adg_null_clk_get(struct rsnd_priv *priv)
if (ret < 0)
clk_hw_unregister_fixed_rate(_hw);
- hw = _hw;
+ priv->null_hw = _hw;
}
- return clk_hw_get_clk(hw, NULL_CLK);
+ return clk_hw_get_clk(priv->null_hw, NULL_CLK);
}
static void rsnd_adg_get_clkin(struct rsnd_priv *priv,
@@ -649,6 +648,8 @@ void rsnd_adg_remove(struct rsnd_priv *priv)
for_each_rsnd_clkout(clk, adg, i)
if (adg->clkout[i])
clk_unregister_fixed_rate(adg->clkout[i]);
+ if (priv->null_hw)
+ clk_hw_unregister_fixed_rate(priv->null_hw);
of_clk_del_provider(np);
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 1255a85151db..19e73a1ddb16 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -635,6 +635,7 @@ struct rsnd_priv {
* below value will be filled on rsnd_adg_probe()
*/
void *adg;
+ struct clk_hw *null_hw;
/*
* below value will be filled on rsnd_dma_probe()