devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia@diku.dk>
To: Timur Tabi <timur@freescale.com>
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>,
	devicetree-discuss@lists.ozlabs.org,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	Grant Likely <grant.likely@secretlab.ca>,
	linuxppc-dev@lists.ozlabs.org, Liam Girdwood <lrg@ti.com>
Subject: [PATCH] sound/soc/fsl/fsl_dma.c: add missing of_node_put
Date: Sat, 20 Aug 2011 09:23:45 +0200	[thread overview]
Message-ID: <1313825025-17590-1-git-send-email-julia@diku.dk> (raw)

From: Julia Lawall <julia@diku.dk>

of_parse_phandle increments the reference count of np, so this should be
decremented before trying the next possibility.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1,e2;
@@

*e = of_parse_phandle(...)
... when != of_node_put(e)
    when != true e == NULL
    when != e2 = e
e = e1
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 sound/soc/fsl/fsl_dma.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 0efc04a..b33271b 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -880,10 +880,12 @@ static struct device_node *find_ssi_node(struct device_node *dma_channel_np)
 		np = of_parse_phandle(ssi_np, "fsl,playback-dma", 0);
 		if (np == dma_channel_np)
 			return ssi_np;
+		of_node_put(np);
 
 		np = of_parse_phandle(ssi_np, "fsl,capture-dma", 0);
 		if (np == dma_channel_np)
 			return ssi_np;
+		of_node_put(np);
 	}
 
 	return NULL;

             reply	other threads:[~2011-08-20  7:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-20  7:23 Julia Lawall [this message]
2011-08-22 10:18 ` [PATCH] sound/soc/fsl/fsl_dma.c: add missing of_node_put Liam Girdwood
2011-08-22 14:03 ` Timur Tabi
     [not found]   ` <4E5261A5.5050608-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2011-08-22 14:06     ` Julia Lawall

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=1313825025-17590-1-git-send-email-julia@diku.dk \
    --to=julia@diku.dk \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lrg@ti.com \
    --cc=timur@freescale.com \
    --cc=tiwai@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).