[bug report] ASoC: rsnd: add null CLOCKIN support
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Thu Jun 10 01:31:25 CEST 2021
Hi Dan
Thank you for your research.
> sound/soc/sh/rcar/adg.c
> 423 static int rsnd_adg_get_clkin(struct rsnd_priv *priv)
> 424 {
> 425 struct rsnd_adg *adg = priv->adg;
> 426 struct device *dev = rsnd_priv_to_dev(priv);
> 427 struct clk *clk;
> 428 int i;
> 429
> 430 for (i = 0; i < CLKMAX; i++) {
> 431 clk = devm_clk_get(dev, clk_name[i]);
>
> If devm_clk_get() returns NULL that's not an error.
>
>
> 432
> 433 if (IS_ERR(clk))
> 434 clk = rsnd_adg_null_clk_get(priv);
>
> But I think if rsnd_adg_null_clk_get() returns an error then it is an
> error.
>
>
> 435 if (IS_ERR(clk))
>
> This is impossible.
>
> 436 goto err;
>
> So I think it should be:
>
> if (IS_ERR(clk)) {
> clk = rsnd_adg_null_clk_get(priv);
> if (!clk)
> goto err;
> }
Hmm indeed. Thank you for your report, I didn't notice about it.
How about this ?
----------
diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 0ebee1ed06a9..2b05a1568ee8 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -393,7 +393,7 @@ static struct clk *rsnd_adg_create_null_clk(struct rsnd_priv *priv,
clk = clk_register_fixed_rate(dev, name, parent, 0, 0);
if (IS_ERR(clk)) {
dev_err(dev, "create null clk error\n");
- return NULL;
+ return PTR_ERR(clk);
}
return clk;
@@ -430,9 +430,9 @@ static int rsnd_adg_get_clkin(struct rsnd_priv *priv)
for (i = 0; i < CLKMAX; i++) {
clk = devm_clk_get(dev, clk_name[i]);
- if (IS_ERR(clk))
+ if (IS_ERR_OR_NULL(clk))
clk = rsnd_adg_null_clk_get(priv);
- if (IS_ERR(clk))
+ if (IS_ERR_OR_NULL(clk))
goto err;
adg->clk[i] = clk;
Thank you for your help !!
Best regards
---
Kuninori Morimoto
More information about the Alsa-devel
mailing list