ASoC: samsung: odroid: Fix of_node refcount unbalance
In odroid_audio_probe() some OF nodes are left without reference count decrease after use. Fix it by ensuring required of_node_calls() are done before exiting probe. Reported-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
0b9c9ed6dd
commit
d832d2b246
1 changed files with 12 additions and 7 deletions
|
@ -257,27 +257,31 @@ static int odroid_audio_probe(struct platform_device *pdev)
|
||||||
ret = of_parse_phandle_with_args(cpu, "sound-dai",
|
ret = of_parse_phandle_with_args(cpu, "sound-dai",
|
||||||
"#sound-dai-cells", i, &args);
|
"#sound-dai-cells", i, &args);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
break;
|
||||||
|
|
||||||
if (!args.np) {
|
if (!args.np) {
|
||||||
dev_err(dev, "sound-dai property parse error: %d\n", ret);
|
dev_err(dev, "sound-dai property parse error: %d\n", ret);
|
||||||
return -EINVAL;
|
ret = -EINVAL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = snd_soc_get_dai_name(&args, &link->cpu_dai_name);
|
ret = snd_soc_get_dai_name(&args, &link->cpu_dai_name);
|
||||||
of_node_put(args.np);
|
of_node_put(args.np);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
break;
|
||||||
}
|
}
|
||||||
|
if (ret == 0)
|
||||||
|
cpu_dai = of_parse_phandle(cpu, "sound-dai", 0);
|
||||||
|
|
||||||
cpu_dai = of_parse_phandle(cpu, "sound-dai", 0);
|
|
||||||
of_node_put(cpu);
|
of_node_put(cpu);
|
||||||
of_node_put(codec);
|
of_node_put(codec);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = snd_soc_of_get_dai_link_codecs(dev, codec, codec_link);
|
ret = snd_soc_of_get_dai_link_codecs(dev, codec, codec_link);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err_put_codec_n;
|
goto err_put_cpu_dai;
|
||||||
|
|
||||||
/* Set capture capability only for boards with the MAX98090 CODEC */
|
/* Set capture capability only for boards with the MAX98090 CODEC */
|
||||||
if (codec_link->num_codecs > 1) {
|
if (codec_link->num_codecs > 1) {
|
||||||
|
@ -288,7 +292,7 @@ static int odroid_audio_probe(struct platform_device *pdev)
|
||||||
priv->sclk_i2s = of_clk_get_by_name(cpu_dai, "i2s_opclk1");
|
priv->sclk_i2s = of_clk_get_by_name(cpu_dai, "i2s_opclk1");
|
||||||
if (IS_ERR(priv->sclk_i2s)) {
|
if (IS_ERR(priv->sclk_i2s)) {
|
||||||
ret = PTR_ERR(priv->sclk_i2s);
|
ret = PTR_ERR(priv->sclk_i2s);
|
||||||
goto err_put_codec_n;
|
goto err_put_cpu_dai;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->clk_i2s_bus = of_clk_get_by_name(cpu_dai, "iis");
|
priv->clk_i2s_bus = of_clk_get_by_name(cpu_dai, "iis");
|
||||||
|
@ -310,7 +314,8 @@ err_put_clk_i2s:
|
||||||
clk_put(priv->clk_i2s_bus);
|
clk_put(priv->clk_i2s_bus);
|
||||||
err_put_sclk:
|
err_put_sclk:
|
||||||
clk_put(priv->sclk_i2s);
|
clk_put(priv->sclk_i2s);
|
||||||
err_put_codec_n:
|
err_put_cpu_dai:
|
||||||
|
of_node_put(cpu_dai);
|
||||||
snd_soc_of_put_dai_link_codecs(codec_link);
|
snd_soc_of_put_dai_link_codecs(codec_link);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue