From mboxrd@z Thu Jan 1 00:00:00 1970 From: Liam Girdwood Subject: Re: [PATCH] sound/soc/fsl/fsl_dma.c: add missing of_node_put Date: Mon, 22 Aug 2011 11:18:42 +0100 Message-ID: <4E522D02.9020809@ti.com> References: <1313825025-17590-1-git-send-email-julia@diku.dk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by alsa0.perex.cz (Postfix) with ESMTP id 1AD372450B for ; Mon, 22 Aug 2011 12:18:47 +0200 (CEST) In-Reply-To: <1313825025-17590-1-git-send-email-julia@diku.dk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Julia Lawall Cc: "alsa-devel@alsa-project.org" , Takashi Iwai , "devicetree-discuss@lists.ozlabs.org" , Mark Brown , "kernel-janitors@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Grant Likely , "linuxppc-dev@lists.ozlabs.org" , Timur Tabi List-Id: alsa-devel@alsa-project.org On 20/08/11 08:23, Julia Lawall wrote: > From: Julia Lawall > > 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/) > > // > @@ > expression e,e1,e2; > @@ > > *e = of_parse_phandle(...) > ... when != of_node_put(e) > when != true e == NULL > when != e2 = e > e = e1 > // > > Signed-off-by: Julia Lawall > > --- > 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; > Acked-by: Liam Girdwood From mboxrd@z Thu Jan 1 00:00:00 1970 From: Liam Girdwood Date: Mon, 22 Aug 2011 10:18:42 +0000 Subject: Re: [PATCH] sound/soc/fsl/fsl_dma.c: add missing of_node_put Message-Id: <4E522D02.9020809@ti.com> List-Id: References: <1313825025-17590-1-git-send-email-julia@diku.dk> In-Reply-To: <1313825025-17590-1-git-send-email-julia@diku.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Julia Lawall Cc: "alsa-devel@alsa-project.org" , Takashi Iwai , "devicetree-discuss@lists.ozlabs.org" , Mark Brown , "kernel-janitors@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Grant Likely , "linuxppc-dev@lists.ozlabs.org" , Timur Tabi On 20/08/11 08:23, Julia Lawall wrote: > From: Julia Lawall > > 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/) > > // > @@ > expression e,e1,e2; > @@ > > *e = of_parse_phandle(...) > ... when != of_node_put(e) > when != true e = NULL > when != e2 = e > e = e1 > // > > Signed-off-by: Julia Lawall > > --- > 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; > Acked-by: Liam Girdwood From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mailhost.ti.com", Issuer "VeriSign Class 3 Secure Server CA - G2" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 0A81FB6F57 for ; Mon, 22 Aug 2011 20:30:06 +1000 (EST) Message-ID: <4E522D02.9020809@ti.com> Date: Mon, 22 Aug 2011 11:18:42 +0100 From: Liam Girdwood MIME-Version: 1.0 To: Julia Lawall Subject: Re: [PATCH] sound/soc/fsl/fsl_dma.c: add missing of_node_put References: <1313825025-17590-1-git-send-email-julia@diku.dk> In-Reply-To: <1313825025-17590-1-git-send-email-julia@diku.dk> Content-Type: text/plain; charset="ISO-8859-1" Cc: "alsa-devel@alsa-project.org" , Takashi Iwai , "devicetree-discuss@lists.ozlabs.org" , Mark Brown , "kernel-janitors@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Jaroslav Kysela , "linuxppc-dev@lists.ozlabs.org" , Timur Tabi List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 20/08/11 08:23, Julia Lawall wrote: > From: Julia Lawall > > 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/) > > // > @@ > expression e,e1,e2; > @@ > > *e = of_parse_phandle(...) > ... when != of_node_put(e) > when != true e == NULL > when != e2 = e > e = e1 > // > > Signed-off-by: Julia Lawall > > --- > 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; > Acked-by: Liam Girdwood From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756789Ab1HVKTW (ORCPT ); Mon, 22 Aug 2011 06:19:22 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:50874 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752461Ab1HVKTS (ORCPT ); Mon, 22 Aug 2011 06:19:18 -0400 Message-ID: <4E522D02.9020809@ti.com> Date: Mon, 22 Aug 2011 11:18:42 +0100 From: Liam Girdwood User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 To: Julia Lawall CC: Timur Tabi , "kernel-janitors@vger.kernel.org" , Mark Brown , Jaroslav Kysela , Takashi Iwai , Grant Likely , "alsa-devel@alsa-project.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" , "devicetree-discuss@lists.ozlabs.org" Subject: Re: [PATCH] sound/soc/fsl/fsl_dma.c: add missing of_node_put References: <1313825025-17590-1-git-send-email-julia@diku.dk> In-Reply-To: <1313825025-17590-1-git-send-email-julia@diku.dk> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/08/11 08:23, Julia Lawall wrote: > From: Julia Lawall > > 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/) > > // > @@ > expression e,e1,e2; > @@ > > *e = of_parse_phandle(...) > ... when != of_node_put(e) > when != true e == NULL > when != e2 = e > e = e1 > // > > Signed-off-by: Julia Lawall > > --- > 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; > Acked-by: Liam Girdwood