[PATCH] pci/hotplug/pnv-php: Remove probable double put

Subsystems: linux for powerpc (32-bit and 64-bit), pci subsystem, the rest

STALE1822d

4 messages, 4 authors, 2021-09-07 · open the first message on its own page

[PATCH] pci/hotplug/pnv-php: Remove probable double put

From: Xu Wang <hidden>
Date: 2021-09-07 09:15:22

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

Signed-off-by: Xu Wang <redacted>
---
 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

Re: [PATCH] pci/hotplug/pnv-php: Remove probable double put

From: Bjorn Helgaas <helgaas@kernel.org>
Date: 2021-09-07 11:24:11

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:
quoted hunk
Device node iterators put the previous value of the index variable,
so an explicit put causes a double put.

Signed-off-by: Xu Wang <redacted>
---
 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

Re: [PATCH] pci/hotplug/pnv-php: Remove probable double put

From: Tyrel Datwyler <tyreld@linux.ibm.com>
Date: 2021-09-07 22:02:07

On 9/7/21 1:59 AM, Xu Wang wrote:
quoted hunk
Device node iterators put the previous value of the index variable,
so an explicit put causes a double put.

Signed-off-by: Xu Wang <redacted>
---
 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
 	}
 }

Re: [PATCH] pci/hotplug/pnv-php: Remove probable double put

From: "Oliver O'Halloran" <oohall@gmail.com>
Date: 2021-09-07 23:18:04

On Wed, Sep 8, 2021 at 8:02 AM Tyrel Datwyler [off-list ref] wrote:
On 9/7/21 1:59 AM, Xu Wang wrote:
quoted
Device node iterators put the previous value of the index variable,
so an explicit put causes a double put.

Signed-off-by: Xu Wang <redacted>
---
 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help