All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Simon <horms@verge.net.au>, Liam Girdwood <lgirdwood@gmail.com>
Subject: [PATCH 1/9] ASoC: simple-card: call of_node_put() for dai_link
Date: Thu, 25 Aug 2016 01:49:36 +0000	[thread overview]
Message-ID: <87zio11v7l.wl%kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <871t1d39ta.wl%kuninori.morimoto.gx@renesas.com>


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

We need to call of_node_put() if we used of_get_child_by_name(),
but missing it for "dai-link" loop.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 55638a8..3ce8bb6 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -322,18 +322,21 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 				     struct simple_card_data *priv)
 {
 	struct device *dev = simple_priv_to_dev(priv);
+	struct device_node *dai_link;
 	u32 val;
 	int ret;
 
 	if (!node)
 		return -EINVAL;
 
+	dai_link = of_get_child_by_name(node, PREFIX "dai-link");
+
 	/* The off-codec widgets */
 	if (of_property_read_bool(node, PREFIX "widgets")) {
 		ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card,
 					PREFIX "widgets");
 		if (ret)
-			return ret;
+			goto card_parse_end;
 	}
 
 	/* DAPM routes */
@@ -341,7 +344,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 		ret = snd_soc_of_parse_audio_routing(&priv->snd_card,
 					PREFIX "routing");
 		if (ret)
-			return ret;
+			goto card_parse_end;
 	}
 
 	/* Factor to mclk, used in hw_params() */
@@ -350,7 +353,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 		priv->mclk_fs = val;
 
 	/* Single/Muti DAI link(s) & New style of DT node */
-	if (of_get_child_by_name(node, PREFIX "dai-link")) {
+	if (dai_link) {
 		struct device_node *np = NULL;
 		int i = 0;
 
@@ -360,7 +363,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 							   i, false);
 			if (ret < 0) {
 				of_node_put(np);
-				return ret;
+				goto card_parse_end;
 			}
 			i++;
 		}
@@ -368,14 +371,15 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 		/* For single DAI link & old style of DT node */
 		ret = asoc_simple_card_dai_link_of(node, priv, 0, true);
 		if (ret < 0)
-			return ret;
+			goto card_parse_end;
 	}
 
 	ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX);
-	if (ret)
-		return ret;
 
-	return 0;
+card_parse_end:
+	of_node_put(dai_link);
+
+	return ret;
 }
 
 static int asoc_simple_card_probe(struct platform_device *pdev)
-- 
1.9.1

  reply	other threads:[~2016-08-25  1:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25  1:48 [PATCH 0/9] ASoC: simple-card: tidyup and synchronize patches Kuninori Morimoto
2016-08-25  1:49 ` Kuninori Morimoto [this message]
2016-08-25  1:50 ` [PATCH 2/9] ASoC: simple-card: tidyup mclk-fs of_property_read_u32() usage Kuninori Morimoto
2016-08-25  1:50 ` [PATCH 3/9] ASoC: simple-card: code sync: tidyup simple_priv_to_xxx() macro Kuninori Morimoto
2016-08-25  1:50 ` [PATCH 4/9] ASoC: simple-card: code sync: use simple_priv_to_props() macro Kuninori Morimoto
2016-08-25  1:51 ` [PATCH 5/9] ASoC: simple-card: is GPL v2 Kuninori Morimoto
2016-08-25  1:51 ` [PATCH 6/9] ASoC: simple-card: code sync: tidyup white line Kuninori Morimoto
2016-08-25  1:52 ` [PATCH 7/9] ASoC: simple-card: code sync: use tag Kuninori Morimoto
2016-08-25  1:52 ` [PATCH 8/9] ASoC: simple-card: code sync: rename num_link to num Kuninori Morimoto
     [not found]   ` <201608251635.kJNOT64O%fengguang.wu@intel.com>
2016-08-26  2:51     ` Kuninori Morimoto
2016-08-25  1:53 ` [PATCH 9/9] ASoC: simple-card: use kzalloc() for dai_props / dai_link 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=87zio11v7l.wl%kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=horms@verge.net.au \
    --cc=lgirdwood@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.