From: "Marek Behún" <marek.behun@nic.cz>
To: linux-pci@vger.kernel.org
Cc: "Tomasz Maciej Nowak" <tmn505@gmail.com>,
"Gregory Clement" <gregory.clement@bootlin.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
linux-kernel@vger.kernel.org, "Andrew Lunn" <andrew@lunn.ch>,
Xogium <contact@xogium.me>, "Pali Rohár" <pali@kernel.org>,
"Marek Behún" <marek.behun@nic.cz>
Subject: [PATCH 2/5] PCI: aardvark: Check for errors from pci_bridge_emul_init() call
Date: Wed, 15 Jul 2020 16:25:54 +0200 [thread overview]
Message-ID: <20200715142557.17115-3-marek.behun@nic.cz> (raw)
In-Reply-To: <20200715142557.17115-1-marek.behun@nic.cz>
From: Pali Rohár <pali@kernel.org>
Function pci_bridge_emul_init() may fail so correctly check for errors.
Fixes: 8a3ebd8de328 ("PCI: aardvark: Implement emulated root PCI bridge config space")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
---
drivers/pci/controller/pci-aardvark.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index 8caa80b19cf8..d5f58684d962 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -608,7 +608,7 @@ static struct pci_bridge_emul_ops advk_pci_bridge_emul_ops = {
* Initialize the configuration space of the PCI-to-PCI bridge
* associated with the given PCIe interface.
*/
-static void advk_sw_pci_bridge_init(struct advk_pcie *pcie)
+static int advk_sw_pci_bridge_init(struct advk_pcie *pcie)
{
struct pci_bridge_emul *bridge = &pcie->bridge;
@@ -634,8 +634,7 @@ static void advk_sw_pci_bridge_init(struct advk_pcie *pcie)
bridge->data = pcie;
bridge->ops = &advk_pci_bridge_emul_ops;
- pci_bridge_emul_init(bridge, 0);
-
+ return pci_bridge_emul_init(bridge, 0);
}
static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus,
@@ -1169,7 +1168,11 @@ static int advk_pcie_probe(struct platform_device *pdev)
advk_pcie_setup_hw(pcie);
- advk_sw_pci_bridge_init(pcie);
+ ret = advk_sw_pci_bridge_init(pcie);
+ if (ret) {
+ dev_err(dev, "Failed to register emulated root PCI bridge\n");
+ return ret;
+ }
ret = advk_pcie_init_irq_domain(pcie);
if (ret) {
--
2.26.2
next prev parent reply other threads:[~2020-07-15 14:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-15 14:25 [PATCH 0/5] PCIe aardvark controller improvements Marek Behún
2020-07-15 14:25 ` [PATCH 1/5] PCI: aardvark: Fix compilation on s390 Marek Behún
2020-07-15 14:25 ` Marek Behún [this message]
2020-07-15 14:25 ` [PATCH 3/5] PCI: pci-bridge-emul: Export API functions Marek Behún
2020-07-15 14:25 ` [PATCH 4/5] PCI: aardvark: Implement driver 'remove' function and allow to build it as module Marek Behún
2020-07-29 18:48 ` Rob Herring
2020-08-03 14:46 ` Pali Rohár
2020-08-03 20:00 ` Rob Herring
2020-08-04 7:24 ` Pali Rohár
2020-07-15 14:25 ` [PATCH 5/5] PCI: aardvark: Move PCIe reset card code to advk_pcie_train_link() Marek Behún
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=20200715142557.17115-3-marek.behun@nic.cz \
--to=marek.behun@nic.cz \
--cc=andrew@lunn.ch \
--cc=bhelgaas@google.com \
--cc=contact@xogium.me \
--cc=gregory.clement@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=pali@kernel.org \
--cc=tmn505@gmail.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;
as well as URLs for NNTP newsgroup(s).