Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Mark Brown <broonie@kernel.org>
Cc: Sangbeom Kim <sbkim73@samsung.com>,
	alsa-devel@alsa-project.org,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>
Subject: [PATCH 6/6] ASoC: samsung: Fix of-node refcount unbalance in odroid_audio_probe()
Date: Tue, 19 Feb 2019 16:46:52 +0100	[thread overview]
Message-ID: <20190219154652.13644-7-tiwai@suse.de> (raw)
In-Reply-To: <20190219154652.13644-1-tiwai@suse.de>

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

  parent reply	other threads:[~2019-02-19 15:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 15:46 [PATCH 0/6] ASoC: Fix of-node refcount unbalance Takashi Iwai
2019-02-19 15:46 ` [PATCH 1/6] ASoC: fsl: Fix of-node refcount unbalance in fsl_ssi_probe_from_dt() Takashi Iwai
2019-02-20  5:29   ` Nicolin Chen
2019-02-20 12:13   ` Applied "ASoC: fsl: Fix of-node refcount unbalance in fsl_ssi_probe_from_dt()" to the asoc tree Mark Brown
2019-02-19 15:46 ` [PATCH 2/6] ASoC: simple-card: Fix missing of_node_put() at simple_dai_link_of() Takashi Iwai
2019-02-20 12:13   ` Applied "ASoC: simple-card: Fix missing of_node_put() at simple_dai_link_of()" to the asoc tree Mark Brown
2019-02-19 15:46 ` [PATCH 3/6] ASoC: simple-card: Fix of-node refcount unbalance in DAI-link parser Takashi Iwai
2019-02-20 12:13   ` Applied "ASoC: simple-card: Fix of-node refcount unbalance in DAI-link parser" to the asoc tree Mark Brown
2019-02-19 15:46 ` [PATCH 4/6] ASoC: qcom: Fix of-node refcount unbalance in apq8016_sbc_parse_of() Takashi Iwai
2019-02-20 17:52   ` Applied "ASoC: qcom: Fix of-node refcount unbalance in apq8016_sbc_parse_of()" to the asoc tree Mark Brown
2019-02-19 15:46 ` [PATCH 5/6] ASoC: qcom: Fix of-node refcount unbalance in qcom_snd_parse_of() Takashi Iwai
2019-02-20 17:52   ` Applied "ASoC: qcom: Fix of-node refcount unbalance in qcom_snd_parse_of()" to the asoc tree Mark Brown
2019-02-19 15:46 ` Takashi Iwai [this message]
2019-02-19 16:36   ` [PATCH 6/6] ASoC: samsung: Fix of-node refcount unbalance in odroid_audio_probe() Sylwester Nawrocki
2019-02-20 10:40     ` Takashi Iwai
2019-02-20 11:06       ` Sylwester Nawrocki
2019-02-20  0:27 ` [PATCH 0/6] ASoC: Fix of-node refcount unbalance Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190219154652.13644-7-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=krzk@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sbkim73@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox