From: Rob Herring <robh@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 1/2] PCI: Fix pci_register_host_bridge() device_register() error handling
Date: Wed, 13 May 2020 17:38:58 -0500 [thread overview]
Message-ID: <20200513223859.11295-1-robh@kernel.org> (raw)
If device_register() has an error, we should bail out of
pci_register_host_bridge() rather than continuing on.
Fixes: 37d6a0a6f470 ("PCI: Add pci_register_host_bridge() interface")
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/probe.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 77b8a145c39b..e21dc71b1907 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -909,9 +909,10 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
goto free;
err = device_register(&bridge->dev);
- if (err)
+ if (err) {
put_device(&bridge->dev);
-
+ goto free;
+ }
bus->bridge = get_device(&bridge->dev);
device_enable_async_suspend(bus->bridge);
pci_set_bus_of_node(bus);
--
2.20.1
next reply other threads:[~2020-05-13 22:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 22:38 Rob Herring [this message]
2020-05-13 22:38 ` [PATCH 2/2] PCI: Fix pci_host_bridge struct device release/free handling Rob Herring
2020-05-14 10:27 ` Anders Roxell
2020-05-14 10:30 ` Lorenzo Pieralisi
2020-05-14 12:50 ` Rob Herring
2020-05-14 16:43 ` Lorenzo Pieralisi
2020-05-14 21:22 ` Arnd Bergmann
2020-05-14 16:41 ` [PATCH 1/2] PCI: Fix pci_register_host_bridge() device_register() error handling Lorenzo Pieralisi
2020-05-14 21:16 ` Arnd Bergmann
2020-05-14 21:37 ` Bjorn Helgaas
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=20200513223859.11295-1-robh@kernel.org \
--to=robh@kernel.org \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox