提交 caecb05c 编写于 作者: K Krzysztof Wilczyński 提交者: Bjorn Helgaas

PCI: Remove dev_err() when handing an error from platform_get_irq()

There is no need to call the dev_err() function directly to print a
custom message when handling an error from either the platform_get_irq() or
platform_get_irq_byname() functions as both are going to display an
appropriate error message in case of a failure.

This change is as per suggestions from Coccinelle, e.g.,

  drivers/pci/controller/dwc/pcie-armada8k.c:252:2-9: line 252 is
  redundant because platform_get_irq() already prints an error

[bhelgaas: squashed into one commit]
Suggested-by: NBjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20200802142601.1635926-2-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-3-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-4-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-5-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-6-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-7-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-8-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-9-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-10-kw@linux.com
Link: https://lore.kernel.org/r/20200803071040.1663662-1-kw@linux.comSigned-off-by: NKrzysztof Wilczyński <kw@linux.com>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com> # altera
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> # dwc
上级 b3a9e3b9
...@@ -629,10 +629,8 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx, ...@@ -629,10 +629,8 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,
struct resource *res; struct resource *res;
pp->irq = platform_get_irq(pdev, 1); pp->irq = platform_get_irq(pdev, 1);
if (pp->irq < 0) { if (pp->irq < 0)
dev_err(dev, "missing IRQ resource\n");
return pp->irq; return pp->irq;
}
ret = dra7xx_pcie_init_irq_domain(pp); ret = dra7xx_pcie_init_irq_domain(pp);
if (ret < 0) if (ret < 0)
...@@ -871,10 +869,8 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) ...@@ -871,10 +869,8 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)
pci->ops = &dw_pcie_ops; pci->ops = &dw_pcie_ops;
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0)
dev_err(dev, "missing IRQ resource: %d\n", irq);
return irq; return irq;
}
base = devm_platform_ioremap_resource_byname(pdev, "ti_conf"); base = devm_platform_ioremap_resource_byname(pdev, "ti_conf");
if (IS_ERR(base)) if (IS_ERR(base))
......
...@@ -402,10 +402,9 @@ static int __init exynos_add_pcie_port(struct exynos_pcie *ep, ...@@ -402,10 +402,9 @@ static int __init exynos_add_pcie_port(struct exynos_pcie *ep,
int ret; int ret;
pp->irq = platform_get_irq(pdev, 1); pp->irq = platform_get_irq(pdev, 1);
if (pp->irq < 0) { if (pp->irq < 0)
dev_err(dev, "failed to get irq\n");
return pp->irq; return pp->irq;
}
ret = devm_request_irq(dev, pp->irq, exynos_pcie_irq_handler, ret = devm_request_irq(dev, pp->irq, exynos_pcie_irq_handler,
IRQF_SHARED, "exynos-pcie", ep); IRQF_SHARED, "exynos-pcie", ep);
if (ret) { if (ret) {
...@@ -415,11 +414,9 @@ static int __init exynos_add_pcie_port(struct exynos_pcie *ep, ...@@ -415,11 +414,9 @@ static int __init exynos_add_pcie_port(struct exynos_pcie *ep,
if (IS_ENABLED(CONFIG_PCI_MSI)) { if (IS_ENABLED(CONFIG_PCI_MSI)) {
pp->msi_irq = platform_get_irq(pdev, 0); pp->msi_irq = platform_get_irq(pdev, 0);
if (pp->msi_irq < 0) { if (pp->msi_irq < 0)
dev_err(dev, "failed to get msi irq\n");
return pp->msi_irq; return pp->msi_irq;
} }
}
pp->ops = &exynos_pcie_host_ops; pp->ops = &exynos_pcie_host_ops;
......
...@@ -868,11 +868,9 @@ static int imx6_add_pcie_port(struct imx6_pcie *imx6_pcie, ...@@ -868,11 +868,9 @@ static int imx6_add_pcie_port(struct imx6_pcie *imx6_pcie,
if (IS_ENABLED(CONFIG_PCI_MSI)) { if (IS_ENABLED(CONFIG_PCI_MSI)) {
pp->msi_irq = platform_get_irq_byname(pdev, "msi"); pp->msi_irq = platform_get_irq_byname(pdev, "msi");
if (pp->msi_irq < 0) { if (pp->msi_irq < 0)
dev_err(dev, "failed to get MSI irq\n");
return pp->msi_irq; return pp->msi_irq;
} }
}
pp->ops = &imx6_pcie_host_ops; pp->ops = &imx6_pcie_host_ops;
......
...@@ -1250,10 +1250,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev) ...@@ -1250,10 +1250,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
pci->version = version; pci->version = version;
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0)
dev_err(dev, "missing IRQ resource: %d\n", irq);
return irq; return irq;
}
ret = request_irq(irq, ks_pcie_err_irq_handler, IRQF_SHARED, ret = request_irq(irq, ks_pcie_err_irq_handler, IRQF_SHARED,
"ks-pcie-error-irq", ks_pcie); "ks-pcie-error-irq", ks_pcie);
......
...@@ -488,11 +488,9 @@ static int meson_add_pcie_port(struct meson_pcie *mp, ...@@ -488,11 +488,9 @@ static int meson_add_pcie_port(struct meson_pcie *mp,
if (IS_ENABLED(CONFIG_PCI_MSI)) { if (IS_ENABLED(CONFIG_PCI_MSI)) {
pp->msi_irq = platform_get_irq(pdev, 0); pp->msi_irq = platform_get_irq(pdev, 0);
if (pp->msi_irq < 0) { if (pp->msi_irq < 0)
dev_err(dev, "failed to get MSI IRQ\n");
return pp->msi_irq; return pp->msi_irq;
} }
}
pp->ops = &meson_pcie_host_ops; pp->ops = &meson_pcie_host_ops;
pci->dbi_base = mp->mem_res.elbi_base; pci->dbi_base = mp->mem_res.elbi_base;
......
...@@ -248,10 +248,8 @@ static int armada8k_add_pcie_port(struct armada8k_pcie *pcie, ...@@ -248,10 +248,8 @@ static int armada8k_add_pcie_port(struct armada8k_pcie *pcie,
pp->ops = &armada8k_pcie_host_ops; pp->ops = &armada8k_pcie_host_ops;
pp->irq = platform_get_irq(pdev, 0); pp->irq = platform_get_irq(pdev, 0);
if (pp->irq < 0) { if (pp->irq < 0)
dev_err(dev, "failed to get irq for port\n");
return pp->irq; return pp->irq;
}
ret = devm_request_irq(dev, pp->irq, armada8k_pcie_irq_handler, ret = devm_request_irq(dev, pp->irq, armada8k_pcie_irq_handler,
IRQF_SHARED, "armada8k-pcie", pcie); IRQF_SHARED, "armada8k-pcie", pcie);
......
...@@ -387,11 +387,9 @@ static int artpec6_add_pcie_port(struct artpec6_pcie *artpec6_pcie, ...@@ -387,11 +387,9 @@ static int artpec6_add_pcie_port(struct artpec6_pcie *artpec6_pcie,
if (IS_ENABLED(CONFIG_PCI_MSI)) { if (IS_ENABLED(CONFIG_PCI_MSI)) {
pp->msi_irq = platform_get_irq_byname(pdev, "msi"); pp->msi_irq = platform_get_irq_byname(pdev, "msi");
if (pp->msi_irq < 0) { if (pp->msi_irq < 0)
dev_err(dev, "failed to get MSI irq\n");
return pp->msi_irq; return pp->msi_irq;
} }
}
pp->ops = &artpec6_pcie_host_ops; pp->ops = &artpec6_pcie_host_ops;
......
...@@ -402,11 +402,9 @@ static int histb_pcie_probe(struct platform_device *pdev) ...@@ -402,11 +402,9 @@ static int histb_pcie_probe(struct platform_device *pdev)
if (IS_ENABLED(CONFIG_PCI_MSI)) { if (IS_ENABLED(CONFIG_PCI_MSI)) {
pp->msi_irq = platform_get_irq_byname(pdev, "msi"); pp->msi_irq = platform_get_irq_byname(pdev, "msi");
if (pp->msi_irq < 0) { if (pp->msi_irq < 0)
dev_err(dev, "Failed to get MSI IRQ\n");
return pp->msi_irq; return pp->msi_irq;
} }
}
hipcie->phy = devm_phy_get(dev, "phy"); hipcie->phy = devm_phy_get(dev, "phy");
if (IS_ERR(hipcie->phy)) { if (IS_ERR(hipcie->phy)) {
......
...@@ -455,11 +455,8 @@ static int kirin_pcie_add_msi(struct dw_pcie *pci, ...@@ -455,11 +455,8 @@ static int kirin_pcie_add_msi(struct dw_pcie *pci,
if (IS_ENABLED(CONFIG_PCI_MSI)) { if (IS_ENABLED(CONFIG_PCI_MSI)) {
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0)
dev_err(&pdev->dev,
"failed to get MSI IRQ (%d)\n", irq);
return irq; return irq;
}
pci->pp.msi_irq = irq; pci->pp.msi_irq = irq;
} }
......
...@@ -198,10 +198,9 @@ static int spear13xx_add_pcie_port(struct spear13xx_pcie *spear13xx_pcie, ...@@ -198,10 +198,9 @@ static int spear13xx_add_pcie_port(struct spear13xx_pcie *spear13xx_pcie,
int ret; int ret;
pp->irq = platform_get_irq(pdev, 0); pp->irq = platform_get_irq(pdev, 0);
if (pp->irq < 0) { if (pp->irq < 0)
dev_err(dev, "failed to get irq\n");
return pp->irq; return pp->irq;
}
ret = devm_request_irq(dev, pp->irq, spear13xx_pcie_irq_handler, ret = devm_request_irq(dev, pp->irq, spear13xx_pcie_irq_handler,
IRQF_SHARED | IRQF_NO_THREAD, IRQF_SHARED | IRQF_NO_THREAD,
"spear1340-pcie", spear13xx_pcie); "spear1340-pcie", spear13xx_pcie);
......
...@@ -2189,10 +2189,8 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev) ...@@ -2189,10 +2189,8 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
} }
pp->irq = platform_get_irq_byname(pdev, "intr"); pp->irq = platform_get_irq_byname(pdev, "intr");
if (pp->irq < 0) { if (pp->irq < 0)
dev_err(dev, "Failed to get \"intr\" interrupt\n");
return pp->irq; return pp->irq;
}
pcie->bpmp = tegra_bpmp_get(dev); pcie->bpmp = tegra_bpmp_get(dev);
if (IS_ERR(pcie->bpmp)) if (IS_ERR(pcie->bpmp))
......
...@@ -170,10 +170,9 @@ static int ls_pcie_g4_interrupt_init(struct mobiveil_pcie *mv_pci) ...@@ -170,10 +170,9 @@ static int ls_pcie_g4_interrupt_init(struct mobiveil_pcie *mv_pci)
int ret; int ret;
pcie->irq = platform_get_irq_byname(pdev, "intr"); pcie->irq = platform_get_irq_byname(pdev, "intr");
if (pcie->irq < 0) { if (pcie->irq < 0)
dev_err(dev, "Can't get 'intr' IRQ, errno = %d\n", pcie->irq);
return pcie->irq; return pcie->irq;
}
ret = devm_request_irq(dev, pcie->irq, ls_pcie_g4_isr, ret = devm_request_irq(dev, pcie->irq, ls_pcie_g4_isr,
IRQF_SHARED, pdev->name, pcie); IRQF_SHARED, pdev->name, pcie);
if (ret) { if (ret) {
......
...@@ -522,10 +522,8 @@ static int mobiveil_pcie_integrated_interrupt_init(struct mobiveil_pcie *pcie) ...@@ -522,10 +522,8 @@ static int mobiveil_pcie_integrated_interrupt_init(struct mobiveil_pcie *pcie)
mobiveil_pcie_enable_msi(pcie); mobiveil_pcie_enable_msi(pcie);
rp->irq = platform_get_irq(pdev, 0); rp->irq = platform_get_irq(pdev, 0);
if (rp->irq < 0) { if (rp->irq < 0)
dev_err(dev, "failed to map IRQ: %d\n", rp->irq);
return rp->irq; return rp->irq;
}
/* initialize the IRQ domains */ /* initialize the IRQ domains */
ret = mobiveil_pcie_init_irq_domain(pcie); ret = mobiveil_pcie_init_irq_domain(pcie);
......
...@@ -1520,10 +1520,8 @@ static int tegra_pcie_get_resources(struct tegra_pcie *pcie) ...@@ -1520,10 +1520,8 @@ static int tegra_pcie_get_resources(struct tegra_pcie *pcie)
/* request interrupt */ /* request interrupt */
err = platform_get_irq_byname(pdev, "intr"); err = platform_get_irq_byname(pdev, "intr");
if (err < 0) { if (err < 0)
dev_err(dev, "failed to get IRQ: %d\n", err);
goto phys_put; goto phys_put;
}
pcie->irq = err; pcie->irq = err;
...@@ -1738,10 +1736,8 @@ static int tegra_pcie_msi_setup(struct tegra_pcie *pcie) ...@@ -1738,10 +1736,8 @@ static int tegra_pcie_msi_setup(struct tegra_pcie *pcie)
} }
err = platform_get_irq_byname(pdev, "msi"); err = platform_get_irq_byname(pdev, "msi");
if (err < 0) { if (err < 0)
dev_err(dev, "failed to get IRQ: %d\n", err);
goto free_irq_domain; goto free_irq_domain;
}
msi->irq = err; msi->irq = err;
......
...@@ -777,10 +777,9 @@ static int v3_pci_probe(struct platform_device *pdev) ...@@ -777,10 +777,9 @@ static int v3_pci_probe(struct platform_device *pdev)
/* Get and request error IRQ resource */ /* Get and request error IRQ resource */
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0)
dev_err(dev, "unable to obtain PCIv3 error IRQ\n");
return irq; return irq;
}
ret = devm_request_irq(dev, irq, v3_irq, 0, ret = devm_request_irq(dev, irq, v3_irq, 0,
"PCIv3 error", v3); "PCIv3 error", v3);
if (ret < 0) { if (ret < 0) {
......
...@@ -478,8 +478,6 @@ static int xgene_msi_probe(struct platform_device *pdev) ...@@ -478,8 +478,6 @@ static int xgene_msi_probe(struct platform_device *pdev)
for (irq_index = 0; irq_index < NR_HW_IRQS; irq_index++) { for (irq_index = 0; irq_index < NR_HW_IRQS; irq_index++) {
virt_msir = platform_get_irq(pdev, irq_index); virt_msir = platform_get_irq(pdev, irq_index);
if (virt_msir < 0) { if (virt_msir < 0) {
dev_err(&pdev->dev, "Cannot translate IRQ index %d\n",
irq_index);
rc = virt_msir; rc = virt_msir;
goto error; goto error;
} }
......
...@@ -256,7 +256,6 @@ static int altera_msi_probe(struct platform_device *pdev) ...@@ -256,7 +256,6 @@ static int altera_msi_probe(struct platform_device *pdev)
msi->irq = platform_get_irq(pdev, 0); msi->irq = platform_get_irq(pdev, 0);
if (msi->irq < 0) { if (msi->irq < 0) {
dev_err(&pdev->dev, "failed to map IRQ: %d\n", msi->irq);
ret = msi->irq; ret = msi->irq;
goto err; goto err;
} }
......
...@@ -713,10 +713,8 @@ static int altera_pcie_parse_dt(struct altera_pcie *pcie) ...@@ -713,10 +713,8 @@ static int altera_pcie_parse_dt(struct altera_pcie *pcie)
/* setup IRQ */ /* setup IRQ */
pcie->irq = platform_get_irq(pdev, 0); pcie->irq = platform_get_irq(pdev, 0);
if (pcie->irq < 0) { if (pcie->irq < 0)
dev_err(dev, "failed to get IRQ: %d\n", pcie->irq);
return pcie->irq; return pcie->irq;
}
irq_set_chained_handler_and_data(pcie->irq, altera_pcie_isr, pcie); irq_set_chained_handler_and_data(pcie->irq, altera_pcie_isr, pcie);
return 0; return 0;
......
...@@ -549,10 +549,8 @@ static int rockchip_pcie_setup_irq(struct rockchip_pcie *rockchip) ...@@ -549,10 +549,8 @@ static int rockchip_pcie_setup_irq(struct rockchip_pcie *rockchip)
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
irq = platform_get_irq_byname(pdev, "sys"); irq = platform_get_irq_byname(pdev, "sys");
if (irq < 0) { if (irq < 0)
dev_err(dev, "missing sys IRQ resource\n");
return irq; return irq;
}
err = devm_request_irq(dev, irq, rockchip_pcie_subsys_irq_handler, err = devm_request_irq(dev, irq, rockchip_pcie_subsys_irq_handler,
IRQF_SHARED, "pcie-sys", rockchip); IRQF_SHARED, "pcie-sys", rockchip);
...@@ -562,20 +560,16 @@ static int rockchip_pcie_setup_irq(struct rockchip_pcie *rockchip) ...@@ -562,20 +560,16 @@ static int rockchip_pcie_setup_irq(struct rockchip_pcie *rockchip)
} }
irq = platform_get_irq_byname(pdev, "legacy"); irq = platform_get_irq_byname(pdev, "legacy");
if (irq < 0) { if (irq < 0)
dev_err(dev, "missing legacy IRQ resource\n");
return irq; return irq;
}
irq_set_chained_handler_and_data(irq, irq_set_chained_handler_and_data(irq,
rockchip_pcie_legacy_int_handler, rockchip_pcie_legacy_int_handler,
rockchip); rockchip);
irq = platform_get_irq_byname(pdev, "client"); irq = platform_get_irq_byname(pdev, "client");
if (irq < 0) { if (irq < 0)
dev_err(dev, "missing client IRQ resource\n");
return irq; return irq;
}
err = devm_request_irq(dev, irq, rockchip_pcie_client_irq_handler, err = devm_request_irq(dev, irq, rockchip_pcie_client_irq_handler,
IRQF_SHARED, "pcie-client", rockchip); IRQF_SHARED, "pcie-client", rockchip);
......
...@@ -273,10 +273,8 @@ static int tango_pcie_probe(struct platform_device *pdev) ...@@ -273,10 +273,8 @@ static int tango_pcie_probe(struct platform_device *pdev)
writel_relaxed(0, pcie->base + SMP8759_ENABLE + offset); writel_relaxed(0, pcie->base + SMP8759_ENABLE + offset);
virq = platform_get_irq(pdev, 1); virq = platform_get_irq(pdev, 1);
if (virq < 0) { if (virq < 0)
dev_err(dev, "Failed to map IRQ\n");
return virq; return virq;
}
irq_dom = irq_domain_create_linear(fwnode, MSI_MAX, &dom_ops, pcie); irq_dom = irq_domain_create_linear(fwnode, MSI_MAX, &dom_ops, pcie);
if (!irq_dom) { if (!irq_dom) {
......
...@@ -586,7 +586,6 @@ static int nwl_pcie_enable_msi(struct nwl_pcie *pcie) ...@@ -586,7 +586,6 @@ static int nwl_pcie_enable_msi(struct nwl_pcie *pcie)
/* Get msi_1 IRQ number */ /* Get msi_1 IRQ number */
msi->irq_msi1 = platform_get_irq_byname(pdev, "msi1"); msi->irq_msi1 = platform_get_irq_byname(pdev, "msi1");
if (msi->irq_msi1 < 0) { if (msi->irq_msi1 < 0) {
dev_err(dev, "failed to get IRQ#%d\n", msi->irq_msi1);
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
...@@ -597,7 +596,6 @@ static int nwl_pcie_enable_msi(struct nwl_pcie *pcie) ...@@ -597,7 +596,6 @@ static int nwl_pcie_enable_msi(struct nwl_pcie *pcie)
/* Get msi_0 IRQ number */ /* Get msi_0 IRQ number */
msi->irq_msi0 = platform_get_irq_byname(pdev, "msi0"); msi->irq_msi0 = platform_get_irq_byname(pdev, "msi0");
if (msi->irq_msi0 < 0) { if (msi->irq_msi0 < 0) {
dev_err(dev, "failed to get IRQ#%d\n", msi->irq_msi0);
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
...@@ -728,11 +726,8 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie) ...@@ -728,11 +726,8 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
/* Get misc IRQ number */ /* Get misc IRQ number */
pcie->irq_misc = platform_get_irq_byname(pdev, "misc"); pcie->irq_misc = platform_get_irq_byname(pdev, "misc");
if (pcie->irq_misc < 0) { if (pcie->irq_misc < 0)
dev_err(dev, "failed to get misc IRQ %d\n",
pcie->irq_misc);
return -EINVAL; return -EINVAL;
}
err = devm_request_irq(dev, pcie->irq_misc, err = devm_request_irq(dev, pcie->irq_misc,
nwl_pcie_misc_handler, IRQF_SHARED, nwl_pcie_misc_handler, IRQF_SHARED,
...@@ -797,10 +792,8 @@ static int nwl_pcie_parse_dt(struct nwl_pcie *pcie, ...@@ -797,10 +792,8 @@ static int nwl_pcie_parse_dt(struct nwl_pcie *pcie,
/* Get intx IRQ number */ /* Get intx IRQ number */
pcie->irq_intx = platform_get_irq_byname(pdev, "intx"); pcie->irq_intx = platform_get_irq_byname(pdev, "intx");
if (pcie->irq_intx < 0) { if (pcie->irq_intx < 0)
dev_err(dev, "failed to get intx IRQ %d\n", pcie->irq_intx);
return pcie->irq_intx; return pcie->irq_intx;
}
irq_set_chained_handler_and_data(pcie->irq_intx, irq_set_chained_handler_and_data(pcie->irq_intx,
nwl_pcie_leg_handler, pcie); nwl_pcie_leg_handler, pcie);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册