diff mbox

[PATCHv2,1/2] ASoC: simple-card: Fix bug of forgetting decrement DT node's refcount

Message ID 1409535327-11449-2-git-send-email-Li.Xiubo@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Xiubo Li Sept. 1, 2014, 1:35 a.m. UTC
We shouldn't forget decrement the last DT node when the
for_each_child_of_node() has finished searching.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/generic/simple-card.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jean-Francois Moine Sept. 1, 2014, 6:37 a.m. UTC | #1
On Mon, 1 Sep 2014 09:35:26 +0800
Xiubo Li <Li.Xiubo@freescale.com> wrote:

> We shouldn't forget decrement the last DT node when the
> for_each_child_of_node() has finished searching.
> 
> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> ---
>  sound/soc/generic/simple-card.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
> index fd8b045..9e170fe 100644
> --- a/sound/soc/generic/simple-card.c
> +++ b/sound/soc/generic/simple-card.c
> @@ -360,6 +360,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
>  			}
>  			i++;
>  		}
> +		of_node_put(np);
>  	} else {
>  		ret = asoc_simple_card_dai_link_of(node, dev,
>  						   dai_link, dai_props, true);

No. np is NULL at end of loop.
Xiubo Li Sept. 1, 2014, 6:52 a.m. UTC | #2
> > Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> > ---
> >  sound/soc/generic/simple-card.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-
> card.c
> > index fd8b045..9e170fe 100644
> > --- a/sound/soc/generic/simple-card.c
> > +++ b/sound/soc/generic/simple-card.c
> > @@ -360,6 +360,7 @@ static int asoc_simple_card_parse_of(struct device_node
> *node,
> >  			}
> >  			i++;
> >  		}
> > +		of_node_put(np);
> >  	} else {
> >  		ret = asoc_simple_card_dai_link_of(node, dev,
> >  						   dai_link, dai_props, true);
> 
> No. np is NULL at end of loop.
> 

Well, yes, you are right.

Thanks,

BRs
Xiubo
diff mbox

Patch

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index fd8b045..9e170fe 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -360,6 +360,7 @@  static int asoc_simple_card_parse_of(struct device_node *node,
 			}
 			i++;
 		}
+		of_node_put(np);
 	} else {
 		ret = asoc_simple_card_dai_link_of(node, dev,
 						   dai_link, dai_props, true);