Skip to content

Commit c046406

Browse files
groeckbjorn-helgaas
authored andcommitted
PCI: dwc: Fix crashes seen due to missing assignments
Fix the following crash, seen in dwc/pci-imx6. Unable to handle kernel NULL pointer dereference at virtual address 00000070 pgd = c0004000 [00000070] *pgd=00000000 Internal error: Oops: 805 [#1] SMP ARM Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.10.0-09686-g9e31489 #1 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) task: cb850000 task.stack: cb84e000 PC is at imx6_pcie_probe+0x2f4/0x414 ... While at it, fix the same problem in various drivers instead of waiting for individual crash reports. The change in the imx6 driver was tested with qemu. The changes in other drivers are based on code inspection and have been compile tested only. Fixes: 442ec4c ("PCI: dwc: all: Split struct pcie_port into host-only and core structures") Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org> # designware-plat Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
1 parent 9e31489 commit c046406

File tree

10 files changed

+18
-0
lines changed

10 files changed

+18
-0
lines changed

drivers/pci/dwc/pci-exynos.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ static int __init exynos_pcie_probe(struct platform_device *pdev)
668668
pci->dev = dev;
669669
pci->ops = &dw_pcie_ops;
670670

671+
ep->pci = pci;
671672
ep->ops = (const struct exynos_pcie_ops *)
672673
of_device_get_match_data(dev);
673674

drivers/pci/dwc/pci-imx6.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
605605
pci->dev = dev;
606606
pci->ops = &dw_pcie_ops;
607607

608+
imx6_pcie->pci = pci;
608609
imx6_pcie->variant =
609610
(enum imx6_pcie_variants)of_device_get_match_data(dev);
610611

drivers/pci/dwc/pci-keystone.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
401401
pci->dev = dev;
402402
pci->ops = &dw_pcie_ops;
403403

404+
ks_pcie->pci = pci;
405+
404406
/* initialize SerDes Phy if present */
405407
phy = devm_phy_get(dev, "pcie-phy");
406408
if (PTR_ERR_OR_ZERO(phy) == -EPROBE_DEFER)

drivers/pci/dwc/pci-layerscape.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ static int __init ls_pcie_probe(struct platform_device *pdev)
280280
pci->dev = dev;
281281
pci->ops = pcie->drvdata->dw_pcie_ops;
282282

283+
pcie->pci = pci;
284+
283285
dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
284286
pci->dbi_base = devm_ioremap_resource(dev, dbi_base);
285287
if (IS_ERR(pci->dbi_base))

drivers/pci/dwc/pcie-armada8k.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ static int armada8k_pcie_probe(struct platform_device *pdev)
220220
pci->dev = dev;
221221
pci->ops = &dw_pcie_ops;
222222

223+
pcie->pci = pci;
224+
223225
pcie->clk = devm_clk_get(dev, NULL);
224226
if (IS_ERR(pcie->clk))
225227
return PTR_ERR(pcie->clk);

drivers/pci/dwc/pcie-artpec6.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ static int artpec6_pcie_probe(struct platform_device *pdev)
253253

254254
pci->dev = dev;
255255

256+
artpec6_pcie->pci = pci;
257+
256258
dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
257259
pci->dbi_base = devm_ioremap_resource(dev, dbi_base);
258260
if (IS_ERR(pci->dbi_base))

drivers/pci/dwc/pcie-designware-plat.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ static int dw_plat_pcie_probe(struct platform_device *pdev)
104104

105105
pci->dev = dev;
106106

107+
dw_plat_pcie->pci = pci;
108+
107109
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
108110
pci->dbi_base = devm_ioremap_resource(dev, res);
109111
if (IS_ERR(pci->dbi_base))

drivers/pci/dwc/pcie-hisi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ static int hisi_pcie_probe(struct platform_device *pdev)
284284

285285
driver = dev->driver;
286286

287+
hisi_pcie->pci = pci;
288+
287289
hisi_pcie->soc_ops = of_device_get_match_data(dev);
288290

289291
hisi_pcie->subctrl =

drivers/pci/dwc/pcie-qcom.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)
686686
pci->ops = &dw_pcie_ops;
687687
pp = &pci->pp;
688688

689+
pcie->pci = pci;
690+
689691
pcie->ops = (struct qcom_pcie_ops *)of_device_get_match_data(dev);
690692

691693
pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_LOW);

drivers/pci/dwc/pcie-spear13xx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ static int spear13xx_pcie_probe(struct platform_device *pdev)
247247
pci->dev = dev;
248248
pci->ops = &dw_pcie_ops;
249249

250+
spear13xx_pcie->pci = pci;
251+
250252
spear13xx_pcie->phy = devm_phy_get(dev, "pcie-phy");
251253
if (IS_ERR(spear13xx_pcie->phy)) {
252254
ret = PTR_ERR(spear13xx_pcie->phy);

0 commit comments

Comments
 (0)