netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port()
@ 2017-08-17  2:25 Ding Tianhong
  2017-08-17  2:42 ` David Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Ding Tianhong @ 2017-08-17  2:25 UTC (permalink / raw)
  To: leedom, ashok.raj, bhelgaas, helgaas, werner, ganeshgr,
	asit.k.mallick, patrick.j.cramer, Suravee.Suthikulpanit,
	Bob.Shaw, l.stach, amira, gabriele.paoloni, David.Laight,
	jeffrey.t.kirsher, catalin.marinas, will.deacon, mark.rutland,
	robin.murphy, davem, alexander.duyck, eric.dumazet,
	linux-arm-kernel, netdev, linux-pci, linux-kernel, linuxarm
  Cc: Ding Tianhong, Thierry Reding

The pci_find_pcie_root_port() would return NULL if the given
dev is already a Root Port, it looks like unfriendly to the
PCIe Root Port device, Thierry and Bjorn suggest to let this
function return the given dev under this circumstances.

Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device")
Suggested-by: Thierry Reding <thierry.reding@gmail.com>
Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7e2022f..352bb53 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res)
  */
 struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev)
 {
-	struct pci_dev *bridge, *highest_pcie_bridge = NULL;
+	struct pci_dev *bridge, *highest_pcie_bridge = dev;
 
 	bridge = pci_upstream_bridge(dev);
 	while (bridge && pci_is_pcie(bridge)) {
-- 
1.8.3.1

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

end of thread, other threads:[~2017-08-18 23:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-17  2:25 [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() Ding Tianhong
2017-08-17  2:42 ` David Miller
2017-08-17 10:51 ` Thierry Reding
2017-08-17 12:40   ` Ding Tianhong
2017-08-17 13:30     ` Thierry Reding
2017-08-17 13:38       ` Ding Tianhong
2017-08-17 11:06 ` [PATCH] PCI: Allow PCI express root ports to find themselves Thierry Reding
2017-08-17 16:58   ` Bjorn Helgaas
2017-08-18  1:29   ` Shawn Lin
2017-08-18  4:32   ` Michael Ellerman
2017-08-18 23:14   ` David Miller

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).