net: Remove dev_err() usage after platform_get_irq()
authorStephen Boyd <swboyd@chromium.org>
Tue, 30 Jul 2019 18:15:51 +0000 (11:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 30 Jul 2019 21:37:35 +0000 (14:37 -0700)
We don't need dev_err() messages when platform_get_irq() fails now that
platform_get_irq() prints an error message itself when something goes
wrong. Let's remove these prints with a simple semantic patch.

// <smpl>
@@
expression ret;
struct platform_device *E;
@@

ret =
(
platform_get_irq(E, ...)
|
platform_get_irq_byname(E, ...)
);

if ( \( ret < 0 \| ret <= 0 \) )
{
(
-if (ret != -EPROBE_DEFER)
-{ ...
-dev_err(...);
-... }
|
...
-dev_err(...);
)
...
}
// </smpl>

While we're here, remove braces on if statements that only have one
statement (manually).

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: Saeed Mahameed <saeedm@mellanox.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Felix Fietkau <nbd@nbd.name>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: netdev@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
20 files changed:
drivers/net/can/janz-ican3.c
drivers/net/can/rcar/rcar_can.c
drivers/net/can/rcar/rcar_canfd.c
drivers/net/can/sun4i_can.c
drivers/net/ethernet/amd/au1000_eth.c
drivers/net/ethernet/amd/xgbe/xgbe-platform.c
drivers/net/ethernet/apm/xgene-v2/main.c
drivers/net/ethernet/apm/xgene/xgene_enet_main.c
drivers/net/ethernet/aurora/nb8800.c
drivers/net/ethernet/broadcom/bgmac-platform.c
drivers/net/ethernet/cortina/gemini.c
drivers/net/ethernet/davicom/dm9000.c
drivers/net/ethernet/hisilicon/hisi_femac.c
drivers/net/ethernet/lantiq_xrx200.c
drivers/net/ethernet/nuvoton/w90p910_ether.c
drivers/net/ethernet/qualcomm/emac/emac.c
drivers/net/ethernet/socionext/sni_ave.c
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
drivers/net/wireless/mediatek/mt76/mt7603/soc.c

index 19d4f52a8f90943c6ab9a4aa3d5af9ec76f484c6..a761092e6ac97f03e6080d0254c983d6b37dc2b8 100644 (file)
@@ -1936,7 +1936,6 @@ static int ican3_probe(struct platform_device *pdev)
        /* find our IRQ number */
        mod->irq = platform_get_irq(pdev, 0);
        if (mod->irq < 0) {
-               dev_err(dev, "IRQ line not found\n");
                ret = -ENODEV;
                goto out_free_ndev;
        }
index 13e66297b65f1f8b5ff28ad6576828f57ef6a607..cf218949a8fb52d52ef21e68e5fb923bd3ae5302 100644 (file)
@@ -759,7 +759,6 @@ static int rcar_can_probe(struct platform_device *pdev)
 
        irq = platform_get_irq(pdev, 0);
        if (irq < 0) {
-               dev_err(&pdev->dev, "No IRQ resource\n");
                err = irq;
                goto fail;
        }
index 05410008aa6b6ee2ac1a6a957c2b0b838f9ee2fc..51eecc7cdcddb70d861825f86fdfa2a884efdabe 100644 (file)
@@ -1651,14 +1651,12 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 
        ch_irq = platform_get_irq(pdev, 0);
        if (ch_irq < 0) {
-               dev_err(&pdev->dev, "no Channel IRQ resource\n");
                err = ch_irq;
                goto fail_dev;
        }
 
        g_irq = platform_get_irq(pdev, 1);
        if (g_irq < 0) {
-               dev_err(&pdev->dev, "no Global IRQ resource\n");
                err = g_irq;
                goto fail_dev;
        }
index 093fc9a529f0816e78b929eb1c5bd635d4d7665c..f4cd88196404257385459c19f866b2e5e65d40c6 100644 (file)
@@ -787,7 +787,6 @@ static int sun4ican_probe(struct platform_device *pdev)
 
        irq = platform_get_irq(pdev, 0);
        if (irq < 0) {
-               dev_err(&pdev->dev, "could not get a valid irq\n");
                err = -ENODEV;
                goto exit;
        }
index 650d1bae5f56fa6bb0fa7557c4db838145dbaa1a..1793950f058270d805183635f9ce8cec1e993052 100644 (file)
@@ -1100,7 +1100,6 @@ static int au1000_probe(struct platform_device *pdev)
 
        irq = platform_get_irq(pdev, 0);
        if (irq < 0) {
-               dev_err(&pdev->dev, "failed to retrieve IRQ\n");
                err = -ENODEV;
                goto out;
        }
index d0f3dfb88202966d315d4ec5bf20b7f8fcf02abe..dce9e59e888143d5d63be588a4fc7639d93c8e78 100644 (file)
@@ -467,10 +467,8 @@ static int xgbe_platform_probe(struct platform_device *pdev)
 
        /* Get the device interrupt */
        ret = platform_get_irq(pdev, 0);
-       if (ret < 0) {
-               dev_err(dev, "platform_get_irq 0 failed\n");
+       if (ret < 0)
                goto err_io;
-       }
        pdata->dev_irq = ret;
 
        /* Get the per channel DMA interrupts */
@@ -479,12 +477,8 @@ static int xgbe_platform_probe(struct platform_device *pdev)
 
                for (i = 0; (i < max) && (dma_irqnum < dma_irqend); i++) {
                        ret = platform_get_irq(pdata->platdev, dma_irqnum++);
-                       if (ret < 0) {
-                               netdev_err(pdata->netdev,
-                                          "platform_get_irq %u failed\n",
-                                          dma_irqnum - 1);
+                       if (ret < 0)
                                goto err_io;
-                       }
 
                        pdata->channel_irq[i] = ret;
                }
@@ -496,10 +490,8 @@ static int xgbe_platform_probe(struct platform_device *pdev)
 
        /* Get the auto-negotiation interrupt */
        ret = platform_get_irq(phy_pdev, phy_irqnum++);
-       if (ret < 0) {
-               dev_err(dev, "platform_get_irq phy 0 failed\n");
+       if (ret < 0)
                goto err_io;
-       }
        pdata->an_irq = ret;
 
        /* Configure the netdev resource */
index 79048cc4670386b43a447cc46172150c20a7b51a..02b4f3af02b54b1f6047b06a42b5391ae8cf96e3 100644 (file)
@@ -54,10 +54,8 @@ static int xge_get_resources(struct xge_pdata *pdata)
        }
 
        ret = platform_get_irq(pdev, 0);
-       if (ret < 0) {
-               dev_err(dev, "Unable to get irq\n");
+       if (ret < 0)
                return ret;
-       }
        pdata->resources.irq = ret;
 
        return 0;
index 949bff4d2921a8e239caef43a2c7e7d115b8dd2a..d8612131c55e0c2de0fa0c2f0bb9df39a17ccd5d 100644 (file)
@@ -1617,7 +1617,6 @@ static int xgene_get_rx_delay(struct xgene_enet_pdata *pdata)
 static int xgene_enet_get_irqs(struct xgene_enet_pdata *pdata)
 {
        struct platform_device *pdev = pdata->pdev;
-       struct device *dev = &pdev->dev;
        int i, ret, max_irqs;
 
        if (phy_interface_mode_is_rgmii(pdata->phy_mode))
@@ -1637,9 +1636,7 @@ static int xgene_enet_get_irqs(struct xgene_enet_pdata *pdata)
                                pdata->cq_cnt = max_irqs / 2;
                                break;
                        }
-                       dev_err(dev, "Unable to get ENET IRQ\n");
-                       ret = ret ? : -ENXIO;
-                       return ret;
+                       return ret ? : -ENXIO;
                }
                pdata->irqs[i] = ret;
        }
index 3b3370a94a9c40a1a98bba630deeab66906a220d..37752d9514e7f3596b6b62420743f1f319436f27 100644 (file)
@@ -1351,10 +1351,8 @@ static int nb8800_probe(struct platform_device *pdev)
                ops = match->data;
 
        irq = platform_get_irq(pdev, 0);
-       if (irq <= 0) {
-               dev_err(&pdev->dev, "No IRQ\n");
+       if (irq <= 0)
                return -EINVAL;
-       }
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        base = devm_ioremap_resource(&pdev->dev, res);
index 6dc0dd91ad11e815e1f2fbcb7efbf64c1e36d078..c46c1b1416f7902da038b0896a7ec01456545b0b 100644 (file)
@@ -199,10 +199,8 @@ static int bgmac_probe(struct platform_device *pdev)
                dev_warn(&pdev->dev, "MAC address not present in device tree\n");
 
        bgmac->irq = platform_get_irq(pdev, 0);
-       if (bgmac->irq < 0) {
-               dev_err(&pdev->dev, "Unable to obtain IRQ\n");
+       if (bgmac->irq < 0)
                return bgmac->irq;
-       }
 
        regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "amac_base");
        if (!regs) {
index 46dd6b4886b6d528e7fed8255eab569b781021d1..e736ce2c58cafd192e0b8453238fcd80959950ca 100644 (file)
@@ -2422,10 +2422,8 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
 
        /* Interrupt */
        irq = platform_get_irq(pdev, 0);
-       if (irq <= 0) {
-               dev_err(dev, "no IRQ\n");
+       if (irq <= 0)
                return irq ? irq : -ENODEV;
-       }
        port->irq = irq;
 
        /* Clock the port */
index 386bdc1378d1d25f8c85156338a4c25637fa8f9f..cce90b5925d93fe70fe5f04060c46e225384c776 100644 (file)
@@ -1500,8 +1500,6 @@ dm9000_probe(struct platform_device *pdev)
 
        ndev->irq = platform_get_irq(pdev, 0);
        if (ndev->irq < 0) {
-               dev_err(db->dev, "interrupt resource unavailable: %d\n",
-                       ndev->irq);
                ret = ndev->irq;
                goto out;
        }
index 689f18e3100f63beba1a5068372fcef89b8e2d73..90ab7ade44c44929e961fbb18a794585f12ffb30 100644 (file)
@@ -877,7 +877,6 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
 
        ndev->irq = platform_get_irq(pdev, 0);
        if (ndev->irq <= 0) {
-               dev_err(dev, "No irq resource\n");
                ret = -ENODEV;
                goto out_disconnect_phy;
        }
index cda641ef89afaca7c236bed2f263ecb218b1be7c..900affbdcc0e4f96739de09356ebd8804f37d299 100644 (file)
@@ -458,17 +458,11 @@ static int xrx200_probe(struct platform_device *pdev)
        }
 
        priv->chan_rx.dma.irq = platform_get_irq_byname(pdev, "rx");
-       if (priv->chan_rx.dma.irq < 0) {
-               dev_err(dev, "failed to get RX IRQ, %i\n",
-                       priv->chan_rx.dma.irq);
+       if (priv->chan_rx.dma.irq < 0)
                return -ENOENT;
-       }
        priv->chan_tx.dma.irq = platform_get_irq_byname(pdev, "tx");
-       if (priv->chan_tx.dma.irq < 0) {
-               dev_err(dev, "failed to get TX IRQ, %i\n",
-                       priv->chan_tx.dma.irq);
+       if (priv->chan_tx.dma.irq < 0)
                return -ENOENT;
-       }
 
        /* get the clock */
        priv->clk = devm_clk_get(dev, NULL);
index 3d73970b3a2ee0c65606f04ce8b3a14d38384520..219b0b863c894733d58efeb2e6a5218c96b19805 100644 (file)
@@ -993,14 +993,12 @@ static int w90p910_ether_probe(struct platform_device *pdev)
 
        ether->txirq = platform_get_irq(pdev, 0);
        if (ether->txirq < 0) {
-               dev_err(&pdev->dev, "failed to get ether tx irq\n");
                error = -ENXIO;
                goto failed_free_io;
        }
 
        ether->rxirq = platform_get_irq(pdev, 1);
        if (ether->rxirq < 0) {
-               dev_err(&pdev->dev, "failed to get ether rx irq\n");
                error = -ENXIO;
                goto failed_free_io;
        }
index 59c2349b59dfbe3eafa069cfd32485a99ad621a3..bfe10464c81fe58938025f932bbca08cc108a059 100644 (file)
@@ -556,11 +556,8 @@ static int emac_probe_resources(struct platform_device *pdev,
 
        /* Core 0 interrupt */
        ret = platform_get_irq(pdev, 0);
-       if (ret < 0) {
-               dev_err(&pdev->dev,
-                       "error: missing core0 irq resource (error=%i)\n", ret);
+       if (ret < 0)
                return ret;
-       }
        adpt->irq.irq = ret;
 
        /* base register address */
index 51a7b48db4bca4b16a517be4dbec68744939b502..87ab0b5da91e4ec94f358aaa0bf5d925ad9178ed 100644 (file)
@@ -1573,10 +1573,8 @@ static int ave_probe(struct platform_device *pdev)
        }
 
        irq = platform_get_irq(pdev, 0);
-       if (irq < 0) {
-               dev_err(dev, "IRQ not found\n");
+       if (irq < 0)
                return irq;
-       }
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        base = devm_ioremap_resource(dev, res);
index 66933332c68edf1b76dfb303c1ed913830380497..f2197b066ed17c2fe79e5413eec208343a23d3eb 100644 (file)
@@ -431,13 +431,8 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
         * resource initialization is done in the glue logic.
         */
        stmmac_res.irq = platform_get_irq(pdev, 0);
-       if (stmmac_res.irq < 0) {
-               if (stmmac_res.irq != -EPROBE_DEFER)
-                       dev_err(&pdev->dev,
-                               "IRQ configuration information not found\n");
-
+       if (stmmac_res.irq < 0)
                return stmmac_res.irq;
-       }
        stmmac_res.wol_irq = stmmac_res.irq;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
index 7ad2bb90ceb140c670225b153b45d5c7f4e29ba3..0f3e6ce7f6ec938e85625af6cfdf4c818e69509b 100644 (file)
@@ -610,13 +610,8 @@ int stmmac_get_platform_resources(struct platform_device *pdev,
         * probe if needed before we went too far with resource allocation.
         */
        stmmac_res->irq = platform_get_irq_byname(pdev, "macirq");
-       if (stmmac_res->irq < 0) {
-               if (stmmac_res->irq != -EPROBE_DEFER) {
-                       dev_err(&pdev->dev,
-                               "MAC IRQ configuration information not found\n");
-               }
+       if (stmmac_res->irq < 0)
                return stmmac_res->irq;
-       }
 
        /* On some platforms e.g. SPEAr the wake up irq differs from the mac irq
         * The external wake up irq can be passed through the platform code
index b920be1f5718b75d2f7374b6bbe6a533ebdec9c2..c6c1ce69bcbca7f68bae13bc69f0aa4d689dfd5d 100644 (file)
@@ -17,10 +17,8 @@ mt76_wmac_probe(struct platform_device *pdev)
        int ret;
 
        irq = platform_get_irq(pdev, 0);
-       if (irq < 0) {
-               dev_err(&pdev->dev, "Failed to get device IRQ\n");
+       if (irq < 0)
                return irq;
-       }
 
        mem_base = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(mem_base)) {