All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] mfd: Add missing of_node_put for loop iteration
@ 2021-05-28 11:51 Krzysztof Kozlowski
  2021-09-22  8:13 ` Krzysztof Kozlowski
  2021-10-06  7:58 ` Lee Jones
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2021-05-28 11:51 UTC (permalink / raw)
  To: Lee Jones, Samuel Ortiz, linux-kernel; +Cc: Krzysztof Kozlowski

Early exits from for_each_child_of_node() should decrement the
node reference counter.  Reported by Coccinelle:

  drivers/mfd/mfd-core.c:197:2-24: WARNING:
    Function "for_each_child_of_node" should have of_node_put() before goto around lines 209.

Fixes: c94bb233a9fe ("mfd: Make MFD core code Device Tree and IRQ domain aware")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/mfd/mfd-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 79f5c6a18815..684a011a6396 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -198,6 +198,7 @@ static int mfd_add_device(struct device *parent, int id,
 			if (of_device_is_compatible(np, cell->of_compatible)) {
 				/* Ignore 'disabled' devices error free */
 				if (!of_device_is_available(np)) {
+					of_node_put(np);
 					ret = 0;
 					goto fail_alias;
 				}
@@ -205,6 +206,7 @@ static int mfd_add_device(struct device *parent, int id,
 				ret = mfd_match_of_node_to_dev(pdev, np, cell);
 				if (ret == -EAGAIN)
 					continue;
+				of_node_put(np);
 				if (ret)
 					goto fail_alias;
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RESEND PATCH] mfd: Add missing of_node_put for loop iteration
  2021-05-28 11:51 [RESEND PATCH] mfd: Add missing of_node_put for loop iteration Krzysztof Kozlowski
@ 2021-09-22  8:13 ` Krzysztof Kozlowski
  2021-09-22 13:08   ` Lee Jones
  2021-10-06  7:58 ` Lee Jones
  1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2021-09-22  8:13 UTC (permalink / raw)
  To: Lee Jones, Samuel Ortiz, linux-kernel

On 28/05/2021 13:51, Krzysztof Kozlowski wrote:
> Early exits from for_each_child_of_node() should decrement the
> node reference counter.  Reported by Coccinelle:
> 
>   drivers/mfd/mfd-core.c:197:2-24: WARNING:
>     Function "for_each_child_of_node" should have of_node_put() before goto around lines 209.
> 
> Fixes: c94bb233a9fe ("mfd: Make MFD core code Device Tree and IRQ domain aware")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  drivers/mfd/mfd-core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> index 79f5c6a18815..684a011a6396 100644
> --- a/drivers/mfd/mfd-core.c
> +++ b/drivers/mfd/mfd-core.c
> @@ -198,6 +198,7 @@ static int mfd_add_device(struct device *parent, int id,
>  			if (of_device_is_compatible(np, cell->of_compatible)) {
>  				/* Ignore 'disabled' devices error free */
>  				if (!of_device_is_available(np)) {
> +					of_node_put(np);
>  					ret = 0;
>  					goto fail_alias;
>  				}
> @@ -205,6 +206,7 @@ static int mfd_add_device(struct device *parent, int id,
>  				ret = mfd_match_of_node_to_dev(pdev, np, cell);
>  				if (ret == -EAGAIN)
>  					continue;
> +				of_node_put(np);
>  				if (ret)
>  					goto fail_alias;
>  
> 

Dear Lee,

This was already a resend. Any comments from your side?

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND PATCH] mfd: Add missing of_node_put for loop iteration
  2021-09-22  8:13 ` Krzysztof Kozlowski
@ 2021-09-22 13:08   ` Lee Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2021-09-22 13:08 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Samuel Ortiz, linux-kernel

On Wed, 22 Sep 2021, Krzysztof Kozlowski wrote:

> On 28/05/2021 13:51, Krzysztof Kozlowski wrote:
> > Early exits from for_each_child_of_node() should decrement the
> > node reference counter.  Reported by Coccinelle:
> > 
> >   drivers/mfd/mfd-core.c:197:2-24: WARNING:
> >     Function "for_each_child_of_node" should have of_node_put() before goto around lines 209.
> > 
> > Fixes: c94bb233a9fe ("mfd: Make MFD core code Device Tree and IRQ domain aware")
> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> > ---
> >  drivers/mfd/mfd-core.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> > index 79f5c6a18815..684a011a6396 100644
> > --- a/drivers/mfd/mfd-core.c
> > +++ b/drivers/mfd/mfd-core.c
> > @@ -198,6 +198,7 @@ static int mfd_add_device(struct device *parent, int id,
> >  			if (of_device_is_compatible(np, cell->of_compatible)) {
> >  				/* Ignore 'disabled' devices error free */
> >  				if (!of_device_is_available(np)) {
> > +					of_node_put(np);
> >  					ret = 0;
> >  					goto fail_alias;
> >  				}
> > @@ -205,6 +206,7 @@ static int mfd_add_device(struct device *parent, int id,
> >  				ret = mfd_match_of_node_to_dev(pdev, np, cell);
> >  				if (ret == -EAGAIN)
> >  					continue;
> > +				of_node_put(np);
> >  				if (ret)
> >  					goto fail_alias;
> >  
> > 
> 
> Dear Lee,
> 
> This was already a resend. Any comments from your side?

Looks like the last batch was RFC.

These all slipped through the net.

Back on my review pile, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND PATCH] mfd: Add missing of_node_put for loop iteration
  2021-05-28 11:51 [RESEND PATCH] mfd: Add missing of_node_put for loop iteration Krzysztof Kozlowski
  2021-09-22  8:13 ` Krzysztof Kozlowski
@ 2021-10-06  7:58 ` Lee Jones
  1 sibling, 0 replies; 4+ messages in thread
From: Lee Jones @ 2021-10-06  7:58 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Samuel Ortiz, linux-kernel

On Fri, 28 May 2021, Krzysztof Kozlowski wrote:

> Early exits from for_each_child_of_node() should decrement the
> node reference counter.  Reported by Coccinelle:
> 
>   drivers/mfd/mfd-core.c:197:2-24: WARNING:
>     Function "for_each_child_of_node" should have of_node_put() before goto around lines 209.
> 
> Fixes: c94bb233a9fe ("mfd: Make MFD core code Device Tree and IRQ domain aware")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  drivers/mfd/mfd-core.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-06  7:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28 11:51 [RESEND PATCH] mfd: Add missing of_node_put for loop iteration Krzysztof Kozlowski
2021-09-22  8:13 ` Krzysztof Kozlowski
2021-09-22 13:08   ` Lee Jones
2021-10-06  7:58 ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.