linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] PCI: Fix the order in unregister path
@ 2021-08-25  8:34 Yajun Deng
  2021-08-25 13:55 ` Rob Herring
  2021-08-26  3:57 ` yajun.deng
  0 siblings, 2 replies; 7+ messages in thread
From: Yajun Deng @ 2021-08-25  8:34 UTC (permalink / raw)
  To: bhelgaas, arnd, robh, lorenzo.pieralisi
  Cc: linux-pci, linux-kernel, Yajun Deng

device_del() should be called first and then called put_device() in
unregister path, becase if that the final reference count, the device
will be cleaned up via device_release() above. So use device_unregister()
instead.

Fixes: 9885440b16b8 (PCI: Fix pci_host_bridge struct device release/free handling)
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 drivers/pci/probe.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0ec5c792c27d..abd481a15a17 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -994,9 +994,7 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
 	return 0;
 
 unregister:
-	put_device(&bridge->dev);
-	device_del(&bridge->dev);
-
+	device_unregister(&bridge->dev);
 free:
 	kfree(bus);
 	return err;
-- 
2.32.0


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

end of thread, other threads:[~2021-08-31  2:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25  8:34 [PATCH linux-next] PCI: Fix the order in unregister path Yajun Deng
2021-08-25 13:55 ` Rob Herring
2021-08-26  3:57 ` yajun.deng
2021-08-26 12:01   ` Rob Herring
2021-08-27  2:39   ` yajun.deng
2021-08-30 14:55     ` Rob Herring
2021-08-31  2:41     ` yajun.deng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).