# \[PATCH\] \[v2\] sound/soc/fsl/fsl\_dma.c: add missing of\_node\_put

- Subsystems: FREESCALE SOC SOUND DRIVERS, SOUND, SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC), THE REST
- Maintainers: Shengjiu Wang, Xiubo Li, Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown, Linus Torvalds
- List: linuxppc-dev
- 4 messages, 3 authors
- Page: https://ratatoskr.run/linuxppc-dev/2011/08/3755423/t

## \[PATCH\] \[v2\] sound/soc/fsl/fsl\_dma.c: add missing of\_node\_put

- From: Timur Tabi \<hidden\>
- Date: 2011-08-22 14:22:49 
- Message: https://ratatoskr.run/linuxppc-dev/2011/08/3755423.md

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

Since we don't actually use np, we can decrement the reference count
immediately.

Reported-by: Julia Lawall <redacted>
Signed-off-by: Timur Tabi <redacted>
---
 sound/soc/fsl/fsl_dma.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 6680c0b..b300f4b 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -877,10 +877,12 @@ static struct device_node *find_ssi_node(struct device_node *dma_channel_np)
 		 * assume that device_node pointers are a valid comparison.
 		 */
 		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;
 	}
-- 
1.7.3.4
```

## Re: \[PATCH\] \[v2\] sound/soc/fsl/fsl\_dma.c: add missing of\_node\_put

- From: Liam Girdwood \<hidden\>
- Date: 2011-08-22 20:06:09 
- Message: https://ratatoskr.run/linuxppc-dev/2011/08/3755562.md

```text
On 22/08/11 15:22, Timur Tabi wrote:
> of_parse_phandle increments the reference count of np, so this should be
> decremented before trying the next possibility.
> 
> Since we don't actually use np, we can decrement the reference count
> immediately.
> 
> Reported-by: Julia Lawall <redacted>
> Signed-off-by: Timur Tabi <redacted>

Acked-by: Liam Girdwood <redacted>

> ---
>  sound/soc/fsl/fsl_dma.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
> index 6680c0b..b300f4b 100644
> --- a/sound/soc/fsl/fsl_dma.c
> +++ b/sound/soc/fsl/fsl_dma.c
> @@ -877,10 +877,12 @@ static struct device_node *find_ssi_node(struct device_node *dma_channel_np)
>  		 * assume that device_node pointers are a valid comparison.
>  		 */
>  		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;
>  	}
```

## Re: \[PATCH\] \[v2\] sound/soc/fsl/fsl\_dma.c: add missing of\_node\_put

- From: Mark Brown \<hidden\>
- Date: 2011-08-22 22:27:26 
- Message: https://ratatoskr.run/linuxppc-dev/2011/08/3755610.md

```text
On Mon, Aug 22, 2011 at 09:22:41AM -0500, Timur Tabi wrote:
> of_parse_phandle increments the reference count of np, so this should be
> decremented before trying the next possibility.
> 
> Since we don't actually use np, we can decrement the reference count
> immediately.

Applied, thanks.
```

## Re: \[PATCH\] \[v2\] sound/soc/fsl/fsl\_dma.c: add missing of\_node\_put

- From: Mark Brown \<hidden\>
- Date: 2011-08-22 22:30:37 
- Message: https://ratatoskr.run/linuxppc-dev/2011/08/3755616.md

```text
On Mon, Aug 22, 2011 at 09:22:41AM -0500, Timur Tabi wrote:
> of_parse_phandle increments the reference count of np, so this should be
> decremented before trying the next possibility.
> 
> Since we don't actually use np, we can decrement the reference count
> immediately.

Applied, thanks.
```
