PCI: dwc: Fix crashes seen due to missing assignments
authorGuenter Roeck <linux@roeck-us.net>
Sat, 25 Feb 2017 10:08:12 +0000 (02:08 -0800)
committerBjorn Helgaas <bhelgaas@google.com>
Sat, 25 Feb 2017 15:06:02 +0000 (09:06 -0600)
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: 442ec4c04d12 ("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>
drivers/pci/dwc/pci-exynos.c
drivers/pci/dwc/pci-imx6.c
drivers/pci/dwc/pci-keystone.c
drivers/pci/dwc/pci-layerscape.c
drivers/pci/dwc/pcie-armada8k.c
drivers/pci/dwc/pcie-artpec6.c
drivers/pci/dwc/pcie-designware-plat.c
drivers/pci/dwc/pcie-hisi.c
drivers/pci/dwc/pcie-qcom.c
drivers/pci/dwc/pcie-spear13xx.c

index 001c91a945aa64401d9ae3ec428aae4d1492cd26..993b650ef2759cbffc56c0bc086a8d2172ef4fcf 100644 (file)
@@ -668,6 +668,7 @@ static int __init exynos_pcie_probe(struct platform_device *pdev)
        pci->dev = dev;
        pci->ops = &dw_pcie_ops;
 
+       ep->pci = pci;
        ep->ops = (const struct exynos_pcie_ops *)
                of_device_get_match_data(dev);
 
index 3ab6761db9e8ad4f77ceae1680ce5fef20c3ee6e..801e46cd266d79463e9b1a96fb418769c3414548 100644 (file)
@@ -605,6 +605,7 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
        pci->dev = dev;
        pci->ops = &dw_pcie_ops;
 
+       imx6_pcie->pci = pci;
        imx6_pcie->variant =
                (enum imx6_pcie_variants)of_device_get_match_data(dev);
 
index 8dc66409182da0cc8758ec108ecceca6ef9b75de..fcc9723bad6e01ac7aee04ff5a406510aade5b6d 100644 (file)
@@ -401,6 +401,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
        pci->dev = dev;
        pci->ops = &dw_pcie_ops;
 
+       ks_pcie->pci = pci;
+
        /* initialize SerDes Phy if present */
        phy = devm_phy_get(dev, "pcie-phy");
        if (PTR_ERR_OR_ZERO(phy) == -EPROBE_DEFER)
index 175c09e3a9326154f87cb05b4e532133c0f66155..c32e392a0ae6f89beec5b088ab1da4580b37fa36 100644 (file)
@@ -280,6 +280,8 @@ static int __init ls_pcie_probe(struct platform_device *pdev)
        pci->dev = dev;
        pci->ops = pcie->drvdata->dw_pcie_ops;
 
+       pcie->pci = pci;
+
        dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
        pci->dbi_base = devm_ioremap_resource(dev, dbi_base);
        if (IS_ERR(pci->dbi_base))
index 66bac6fbfa9f1c3ba491c5a289253b1becff4caf..f110e3b24a26dc11459d113d1bcffe9ce80e370f 100644 (file)
@@ -220,6 +220,8 @@ static int armada8k_pcie_probe(struct platform_device *pdev)
        pci->dev = dev;
        pci->ops = &dw_pcie_ops;
 
+       pcie->pci = pci;
+
        pcie->clk = devm_clk_get(dev, NULL);
        if (IS_ERR(pcie->clk))
                return PTR_ERR(pcie->clk);
index 59ecc9e664362aed61fd52239a6aa06371c2b426..fcd3ef845883555648e0b2eeda907427d7811144 100644 (file)
@@ -253,6 +253,8 @@ static int artpec6_pcie_probe(struct platform_device *pdev)
 
        pci->dev = dev;
 
+       artpec6_pcie->pci = pci;
+
        dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
        pci->dbi_base = devm_ioremap_resource(dev, dbi_base);
        if (IS_ERR(pci->dbi_base))
index 65250f63515cf0a0597fa8e41de09fc32ac5b3d3..b6c832ba39dd6905a4640e770b69aff47e51b738 100644 (file)
@@ -104,6 +104,8 @@ static int dw_plat_pcie_probe(struct platform_device *pdev)
 
        pci->dev = dev;
 
+       dw_plat_pcie->pci = pci;
+
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        pci->dbi_base = devm_ioremap_resource(dev, res);
        if (IS_ERR(pci->dbi_base))
index e3e4fedd9f68d6fc673a5da3a0697b9655d600b5..fd66a3199db77d41d08e0658d89611370d46446f 100644 (file)
@@ -284,6 +284,8 @@ static int hisi_pcie_probe(struct platform_device *pdev)
 
        driver = dev->driver;
 
+       hisi_pcie->pci = pci;
+
        hisi_pcie->soc_ops = of_device_get_match_data(dev);
 
        hisi_pcie->subctrl =
index e36abe0d9d6f03af594b1b01e3254bec6cadbc69..67eb7f5926ddd2248c53ba3668a0b939e6be1099 100644 (file)
@@ -686,6 +686,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)
        pci->ops = &dw_pcie_ops;
        pp = &pci->pp;
 
+       pcie->pci = pci;
+
        pcie->ops = (struct qcom_pcie_ops *)of_device_get_match_data(dev);
 
        pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_LOW);
index 348f9c5e0433e229737eb53034ed7a0ac94321f6..eaa4ea8e2ea4eacec48788bf86a32b8600a4beb5 100644 (file)
@@ -247,6 +247,8 @@ static int spear13xx_pcie_probe(struct platform_device *pdev)
        pci->dev = dev;
        pci->ops = &dw_pcie_ops;
 
+       spear13xx_pcie->pci = pci;
+
        spear13xx_pcie->phy = devm_phy_get(dev, "pcie-phy");
        if (IS_ERR(spear13xx_pcie->phy)) {
                ret = PTR_ERR(spear13xx_pcie->phy);