All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yajun Deng <yajun.deng@linux.dev>
To: bhelgaas@google.com, arnd@arndb.de, robh@kernel.org,
	lorenzo.pieralisi@arm.com
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yajun Deng <yajun.deng@linux.dev>
Subject: [PATCH linux-next] PCI: Fix the order in unregister path
Date: Wed, 25 Aug 2021 16:34:25 +0800	[thread overview]
Message-ID: <20210825083425.32740-1-yajun.deng@linux.dev> (raw)

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


             reply	other threads:[~2021-08-25  8:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25  8:34 Yajun Deng [this message]
2021-08-25 13:55 ` [PATCH linux-next] PCI: Fix the order in unregister path 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210825083425.32740-1-yajun.deng@linux.dev \
    --to=yajun.deng@linux.dev \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.