[PATCH 6/6] ASoC: samsung: Fix of-node refcount unbalance in odroid_audio_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Cc: Sangbeom Kim <sbkim73@xxxxxxxxxxx>
Cc: Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx>
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---

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;
 }
 
-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux