All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci/hotplug/pnv-php: Remove probable double put
@ 2021-09-07  8:59 ` Xu Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Xu Wang @ 2021-09-07  8:59 UTC (permalink / raw)
  To: mpe, benh, paulus, bhelgaas; +Cc: linuxppc-dev, linux-pci, linux-kernel

Device node iterators put the previous value of the index variable,
so an explicit put causes a double put.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/pci/hotplug/pnv_php.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index 04565162a449..ed4d1a2c3f22 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -158,7 +158,6 @@ static void pnv_php_detach_device_nodes(struct device_node *parent)
 	for_each_child_of_node(parent, dn) {
 		pnv_php_detach_device_nodes(dn);
 
-		of_node_put(dn);
 		of_detach_node(dn);
 	}
 }
-- 
2.17.1


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

* [PATCH] pci/hotplug/pnv-php: Remove probable double put
@ 2021-09-07  8:59 ` Xu Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Xu Wang @ 2021-09-07  8:59 UTC (permalink / raw)
  To: mpe, benh, paulus, bhelgaas; +Cc: linux-pci, linuxppc-dev, linux-kernel

Device node iterators put the previous value of the index variable,
so an explicit put causes a double put.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/pci/hotplug/pnv_php.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index 04565162a449..ed4d1a2c3f22 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -158,7 +158,6 @@ static void pnv_php_detach_device_nodes(struct device_node *parent)
 	for_each_child_of_node(parent, dn) {
 		pnv_php_detach_device_nodes(dn);
 
-		of_node_put(dn);
 		of_detach_node(dn);
 	}
 }
-- 
2.17.1


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

* Re: [PATCH] pci/hotplug/pnv-php: Remove probable double put
  2021-09-07  8:59 ` Xu Wang
@ 2021-09-07 11:24   ` Bjorn Helgaas
  -1 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2021-09-07 11:24 UTC (permalink / raw)
  To: Xu Wang
  Cc: mpe, benh, paulus, bhelgaas, linuxppc-dev, linux-pci, linux-kernel

Make your subject line follow the previous convention.

Figure out if this is a "probable" or a real double put.  If it's a
real double put, we should fix it.  If it's only "probable," that
means we don't understand the problem yet.

On Tue, Sep 07, 2021 at 08:59:46AM +0000, Xu Wang wrote:
> Device node iterators put the previous value of the index variable,
> so an explicit put causes a double put.
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
>  drivers/pci/hotplug/pnv_php.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
> index 04565162a449..ed4d1a2c3f22 100644
> --- a/drivers/pci/hotplug/pnv_php.c
> +++ b/drivers/pci/hotplug/pnv_php.c
> @@ -158,7 +158,6 @@ static void pnv_php_detach_device_nodes(struct device_node *parent)
>  	for_each_child_of_node(parent, dn) {
>  		pnv_php_detach_device_nodes(dn);
>  
> -		of_node_put(dn);
>  		of_detach_node(dn);
>  	}
>  }
> -- 
> 2.17.1
> 

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

* Re: [PATCH] pci/hotplug/pnv-php: Remove probable double put
@ 2021-09-07 11:24   ` Bjorn Helgaas
  0 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2021-09-07 11:24 UTC (permalink / raw)
  To: Xu Wang; +Cc: linux-kernel, paulus, linux-pci, bhelgaas, linuxppc-dev

Make your subject line follow the previous convention.

Figure out if this is a "probable" or a real double put.  If it's a
real double put, we should fix it.  If it's only "probable," that
means we don't understand the problem yet.

On Tue, Sep 07, 2021 at 08:59:46AM +0000, Xu Wang wrote:
> Device node iterators put the previous value of the index variable,
> so an explicit put causes a double put.
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
>  drivers/pci/hotplug/pnv_php.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
> index 04565162a449..ed4d1a2c3f22 100644
> --- a/drivers/pci/hotplug/pnv_php.c
> +++ b/drivers/pci/hotplug/pnv_php.c
> @@ -158,7 +158,6 @@ static void pnv_php_detach_device_nodes(struct device_node *parent)
>  	for_each_child_of_node(parent, dn) {
>  		pnv_php_detach_device_nodes(dn);
>  
> -		of_node_put(dn);
>  		of_detach_node(dn);
>  	}
>  }
> -- 
> 2.17.1
> 

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

* Re: [PATCH] pci/hotplug/pnv-php: Remove probable double put
  2021-09-07  8:59 ` Xu Wang
@ 2021-09-07 22:01   ` Tyrel Datwyler
  -1 siblings, 0 replies; 8+ messages in thread
From: Tyrel Datwyler @ 2021-09-07 22:01 UTC (permalink / raw)
  To: Xu Wang, mpe, benh, paulus, bhelgaas
  Cc: linux-pci, linuxppc-dev, linux-kernel

On 9/7/21 1:59 AM, Xu Wang wrote:
> Device node iterators put the previous value of the index variable,
> so an explicit put causes a double put.
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
>  drivers/pci/hotplug/pnv_php.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
> index 04565162a449..ed4d1a2c3f22 100644
> --- a/drivers/pci/hotplug/pnv_php.c
> +++ b/drivers/pci/hotplug/pnv_php.c
> @@ -158,7 +158,6 @@ static void pnv_php_detach_device_nodes(struct device_node *parent)
>  	for_each_child_of_node(parent, dn) {
>  		pnv_php_detach_device_nodes(dn);
> 
> -		of_node_put(dn);
>  		of_detach_node(dn);

Are you sure this is a double put? This looks to me like its meant to drive tear
down of the device by putting a long term reference and not the short term get
that is part of the iterator.

-Tyrel

>  	}
>  }
> 


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

* Re: [PATCH] pci/hotplug/pnv-php: Remove probable double put
@ 2021-09-07 22:01   ` Tyrel Datwyler
  0 siblings, 0 replies; 8+ messages in thread
From: Tyrel Datwyler @ 2021-09-07 22:01 UTC (permalink / raw)
  To: Xu Wang, mpe, benh, paulus, bhelgaas
  Cc: linux-pci, linuxppc-dev, linux-kernel

On 9/7/21 1:59 AM, Xu Wang wrote:
> Device node iterators put the previous value of the index variable,
> so an explicit put causes a double put.
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
>  drivers/pci/hotplug/pnv_php.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
> index 04565162a449..ed4d1a2c3f22 100644
> --- a/drivers/pci/hotplug/pnv_php.c
> +++ b/drivers/pci/hotplug/pnv_php.c
> @@ -158,7 +158,6 @@ static void pnv_php_detach_device_nodes(struct device_node *parent)
>  	for_each_child_of_node(parent, dn) {
>  		pnv_php_detach_device_nodes(dn);
> 
> -		of_node_put(dn);
>  		of_detach_node(dn);

Are you sure this is a double put? This looks to me like its meant to drive tear
down of the device by putting a long term reference and not the short term get
that is part of the iterator.

-Tyrel

>  	}
>  }
> 


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

* Re: [PATCH] pci/hotplug/pnv-php: Remove probable double put
  2021-09-07 22:01   ` Tyrel Datwyler
@ 2021-09-07 23:17     ` Oliver O'Halloran
  -1 siblings, 0 replies; 8+ messages in thread
From: Oliver O'Halloran @ 2021-09-07 23:17 UTC (permalink / raw)
  To: Tyrel Datwyler
  Cc: Xu Wang, Michael Ellerman, Benjamin Herrenschmidt,
	Paul Mackerras, Bjorn Helgaas, linux-pci, linuxppc-dev,
	Linux Kernel Mailing List

On Wed, Sep 8, 2021 at 8:02 AM Tyrel Datwyler <tyreld@linux.ibm.com> wrote:
>
> On 9/7/21 1:59 AM, Xu Wang wrote:
> > Device node iterators put the previous value of the index variable,
> > so an explicit put causes a double put.
> >
> > Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> > ---
> >  drivers/pci/hotplug/pnv_php.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
> > index 04565162a449..ed4d1a2c3f22 100644
> > --- a/drivers/pci/hotplug/pnv_php.c
> > +++ b/drivers/pci/hotplug/pnv_php.c
> > @@ -158,7 +158,6 @@ static void pnv_php_detach_device_nodes(struct device_node *parent)
> >       for_each_child_of_node(parent, dn) {
> >               pnv_php_detach_device_nodes(dn);
> >
> > -             of_node_put(dn);
> >               of_detach_node(dn);
>
> Are you sure this is a double put? This looks to me like its meant to drive tear
> down of the device by putting a long term reference and not the short term get
> that is part of the iterator.

Yeah, the put is there is to drop the initial ref so the node can be
released. It might be worth adding a comment.

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

* Re: [PATCH] pci/hotplug/pnv-php: Remove probable double put
@ 2021-09-07 23:17     ` Oliver O'Halloran
  0 siblings, 0 replies; 8+ messages in thread
From: Oliver O'Halloran @ 2021-09-07 23:17 UTC (permalink / raw)
  To: Tyrel Datwyler
  Cc: Linux Kernel Mailing List, Paul Mackerras, Xu Wang, linux-pci,
	Bjorn Helgaas, linuxppc-dev

On Wed, Sep 8, 2021 at 8:02 AM Tyrel Datwyler <tyreld@linux.ibm.com> wrote:
>
> On 9/7/21 1:59 AM, Xu Wang wrote:
> > Device node iterators put the previous value of the index variable,
> > so an explicit put causes a double put.
> >
> > Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> > ---
> >  drivers/pci/hotplug/pnv_php.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
> > index 04565162a449..ed4d1a2c3f22 100644
> > --- a/drivers/pci/hotplug/pnv_php.c
> > +++ b/drivers/pci/hotplug/pnv_php.c
> > @@ -158,7 +158,6 @@ static void pnv_php_detach_device_nodes(struct device_node *parent)
> >       for_each_child_of_node(parent, dn) {
> >               pnv_php_detach_device_nodes(dn);
> >
> > -             of_node_put(dn);
> >               of_detach_node(dn);
>
> Are you sure this is a double put? This looks to me like its meant to drive tear
> down of the device by putting a long term reference and not the short term get
> that is part of the iterator.

Yeah, the put is there is to drop the initial ref so the node can be
released. It might be worth adding a comment.

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

end of thread, other threads:[~2021-09-07 23:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07  8:59 [PATCH] pci/hotplug/pnv-php: Remove probable double put Xu Wang
2021-09-07  8:59 ` Xu Wang
2021-09-07 11:24 ` Bjorn Helgaas
2021-09-07 11:24   ` Bjorn Helgaas
2021-09-07 22:01 ` Tyrel Datwyler
2021-09-07 22:01   ` Tyrel Datwyler
2021-09-07 23:17   ` Oliver O'Halloran
2021-09-07 23:17     ` Oliver O'Halloran

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.