PCI: dwc: Fix crashes seen due to missing assignments
PATCH 1/1 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.
--- drivers/pci/dwc/pci-exynos.c | 1 + drivers/pci/dwc/pci-imx6.c | 1 + drivers/pci/dwc/pci-keystone.c | 2 ++ drivers/pci/dwc/pci-layerscape.c | 2 ++ drivers/pci/dwc/pcie-armada8k.c | 2 ++ drivers/pci/dwc/pcie-artpec6.c | 2 ++ drivers/pci/dwc/pcie-hisi.c | 2 ++ drivers/pci/dwc/pcie-qcom.c | 2 ++ drivers/pci/dwc/pcie-spear13xx.c | 2 ++ 9 files changed, 16 insertions(+)
drivers/pci/dwc/pci-exynos.c +1 -0
@@ -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);
drivers/pci/dwc/pci-imx6.c +1 -0
@@ -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);
drivers/pci/dwc/pci-keystone.c +2 -0
@@ -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 )
drivers/pci/dwc/pci-layerscape.c +2 -0
@@ -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))
drivers/pci/dwc/pcie-armada8k.c +2 -0
@@ -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);
drivers/pci/dwc/pcie-artpec6.c +2 -0
@@ -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))
drivers/pci/dwc/pcie-hisi.c +2 -0
@@ -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 =
drivers/pci/dwc/pcie-qcom.c +2 -0
@@ -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 );
drivers/pci/dwc/pcie-spear13xx.c +2 -0
@@ -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);
Signature · 1 line
2.7.4
Hi Guenter,
Quoted 16 lines · Guenter Roeck
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:
cb850000task.stack:cb84e000
PC is atimx6_pcie_probe+0x2f4/0x414
...While at it, fix the same problem in various drivers instead of waiting for individual crash reports.
Quoted 6 lines
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 ...")Cc Kishon Vijay Abraham I <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
looks like I missed the assignment which rebasing. Thanks for fixing it.
-Kishon
Quoted 128 lines
--- drivers/pci/dwc/pci-exynos.c | 1 + drivers/pci/dwc/pci-imx6.c | 1 + drivers/pci/dwc/pci-keystone.c | 2 ++ drivers/pci/dwc/pci-layerscape.c | 2 ++ drivers/pci/dwc/pcie-armada8k.c | 2 ++ drivers/pci/dwc/pcie-artpec6.c | 2 ++ drivers/pci/dwc/pcie-hisi.c | 2 ++ drivers/pci/dwc/pcie-qcom.c | 2 ++ drivers/pci/dwc/pcie-spear13xx.c | 2 ++ 9 files changed, 16 insertions(+)drivers/pci/dwc/pci-exynos.c +1
-0@@ -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);drivers/pci/dwc/pci-imx6.c +1
-0@@ -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);drivers/pci/dwc/pci-keystone.c +2
-0@@ -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 )drivers/pci/dwc/pci-layerscape.c +2
-0@@ -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))drivers/pci/dwc/pcie-armada8k.c +2
-0@@ -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);drivers/pci/dwc/pcie-artpec6.c +2
-0@@ -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))drivers/pci/dwc/pcie-hisi.c +2
-0@@ -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 =drivers/pci/dwc/pcie-qcom.c +2
-0@@ -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 );drivers/pci/dwc/pcie-spear13xx.c +2
-0@@ -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);
Quoted 16 lines · Guenter Roeck
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:
cb850000task.stack:cb84e000
PC is atimx6_pcie_probe+0x2f4/0x414
...While at it, fix the same problem in various drivers instead of waiting for individual crash reports.
Quoted 6 lines
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 ...")Cc Kishon Vijay Abraham I <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Applied with Kishon's ack to for-linus for v4.11, thanks, Guenter!
Quoted 130 lines
--- drivers/pci/dwc/pci-exynos.c | 1 + drivers/pci/dwc/pci-imx6.c | 1 + drivers/pci/dwc/pci-keystone.c | 2 ++ drivers/pci/dwc/pci-layerscape.c | 2 ++ drivers/pci/dwc/pcie-armada8k.c | 2 ++ drivers/pci/dwc/pcie-artpec6.c | 2 ++ drivers/pci/dwc/pcie-hisi.c | 2 ++ drivers/pci/dwc/pcie-qcom.c | 2 ++ drivers/pci/dwc/pcie-spear13xx.c | 2 ++ 9 files changed, 16 insertions(+)drivers/pci/dwc/pci-exynos.c +1
-0@@ -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);drivers/pci/dwc/pci-imx6.c +1
-0@@ -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);drivers/pci/dwc/pci-keystone.c +2
-0@@ -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 )drivers/pci/dwc/pci-layerscape.c +2
-0@@ -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))drivers/pci/dwc/pcie-armada8k.c +2
-0@@ -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);drivers/pci/dwc/pcie-artpec6.c +2
-0@@ -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))drivers/pci/dwc/pcie-hisi.c +2
-0@@ -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 =drivers/pci/dwc/pcie-qcom.c +2
-0@@ -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 );drivers/pci/dwc/pcie-spear13xx.c +2
-0@@ -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);Signature · 1 line
2.7.4