linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/ASPM: Fix a NULL pointer crash on sparc64
@ 2015-08-17 10:47 Yijing Wang
  2015-08-18 18:49 ` Bjorn Helgaas
  2015-08-20  5:48 ` Bjorn Helgaas
  0 siblings, 2 replies; 19+ messages in thread
From: Yijing Wang @ 2015-08-17 10:47 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, mroos, Yijing Wang

Commit d0751b98dfa3 ("PCI: Add dev->has_secondary_link to
track downstream PCIe links")assumed root port is always
the top device in pcie tree. But on sparc64 V245 and T2000
the pcie tree has no root port device in top level, the
upstream port device is connected directly to root bus.
So we may get NULL parent for this upstream port device.

Upstream port ------ Downstream port ------PCIe-PCI bridge

Reported-by: Meelis Roos <mroos@linux.ee>
Tested-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/probe.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 51ebb97..cd54298 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1003,7 +1003,10 @@ void set_pcie_port_type(struct pci_dev *pdev)
 	else if (type == PCI_EXP_TYPE_UPSTREAM ||
 		 type == PCI_EXP_TYPE_DOWNSTREAM) {
 		parent = pci_upstream_bridge(pdev);
-		if (!parent->has_secondary_link)
+		/* For sparc64 V245 and T2000, upstream port may be
+		 * the top level device, connect to root bus directly.
+		 */
+		if (parent && !parent->has_secondary_link)
 			pdev->has_secondary_link = 1;
 	}
 }
-- 
1.7.1


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

end of thread, other threads:[~2015-08-21  1:48 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-17 10:47 [PATCH] PCI/ASPM: Fix a NULL pointer crash on sparc64 Yijing Wang
2015-08-18 18:49 ` Bjorn Helgaas
2015-08-18 19:10   ` David Miller
2015-08-19 22:16     ` Bjorn Helgaas
2015-08-19 22:29       ` Benjamin Herrenschmidt
2015-08-20  6:01         ` Bjorn Helgaas
2015-08-20  6:38           ` Benjamin Herrenschmidt
2015-08-20  6:44           ` Kjetil Oftedal
2015-08-20 17:51             ` David Miller
2015-08-20 17:50           ` David Miller
2015-08-20  5:48 ` Bjorn Helgaas
2015-08-20 17:47   ` David Miller
2015-08-20 18:23     ` Bjorn Helgaas
2015-08-20 18:40       ` David Miller
2015-08-20 20:21         ` Bjorn Helgaas
2015-08-20 20:58           ` David Miller
2015-08-20 21:21             ` Bjorn Helgaas
2015-08-20 21:38               ` David Miller
2015-08-21  1:48               ` wangyijing

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