odroid_audio_probe() leaves of-nodes without unreferenced after use. Fix it by shuffling some code a bit and add the missing of_node_put() calls accordingly.
Fixes: aba611fc4c69 ("ASoC: samsung: Add Odroid ASoC machine driver") Cc: Krzysztof Kozlowski krzk@kernel.org Cc: Sangbeom Kim sbkim73@samsung.com Cc: Sylwester Nawrocki s.nawrocki@samsung.com Signed-off-by: Takashi Iwai tiwai@suse.de ---
Only compile-tested. Please review carefully. Thanks!
sound/soc/samsung/odroid.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/soc/samsung/odroid.c b/sound/soc/samsung/odroid.c index e7b371b07230..c96fbbc8c7cc 100644 --- a/sound/soc/samsung/odroid.c +++ b/sound/soc/samsung/odroid.c @@ -140,14 +140,14 @@ static int odroid_audio_probe(struct platform_device *pdev) card->num_links = 1;
cpu = of_get_child_by_name(dev->of_node, "cpu"); - codec = of_get_child_by_name(dev->of_node, "codec"); - link->cpu_of_node = of_parse_phandle(cpu, "sound-dai", 0); + of_node_put(cpu); if (!link->cpu_of_node) { dev_err(dev, "Failed parsing cpu/sound-dai property\n"); return -EINVAL; }
+ codec = of_get_child_by_name(dev->of_node, "codec"); ret = snd_soc_of_get_dai_link_codecs(dev, codec, link); if (ret < 0) goto err_put_codec_n; @@ -186,6 +186,7 @@ static int odroid_audio_probe(struct platform_device *pdev) of_node_put(link->cpu_of_node); err_put_codec_n: snd_soc_of_put_dai_link_codecs(link); + of_node_put(codec); return ret; }