From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 22 Aug 2011 16:06:43 +0200 (CEST) From: Julia Lawall To: Timur Tabi Subject: Re: [PATCH] sound/soc/fsl/fsl_dma.c: add missing of_node_put In-Reply-To: <4E5261A5.5050608@freescale.com> Message-ID: References: <1313825025-17590-1-git-send-email-julia@diku.dk> <4E5261A5.5050608@freescale.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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, Liam Girdwood List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Mon, 22 Aug 2011, Timur Tabi wrote: > Julia Lawall wrote: > > 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); > > } > > Thanks for catching the problem, Julia, but the fix is not quite correct. My > code assumes that of_parse_phandle() doesn't claim the node, but it doesn't > actually use the node pointer, either. All I care about is whether 'np' is > equal to dma_channel_np. I'm not going to use 'np'. So I think the real fix is > this: > > @@ -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); > + of_node_put(np); > if (np == dma_channel_np) > return ssi_np; > > np = of_parse_phandle(ssi_np, "fsl,capture-dma", 0); > + of_node_put(np); > if (np == dma_channel_np) > return ssi_np; > } > > return NULL; OK, that looks reasonable. julia