Skip to content

Commit c1e3334

Browse files
JuliaLawalldavem330
authored andcommitted
drivers: net: cpsw: fix error return code
Propagate the return value of platform_get_irq on failure. A simplified version of the semantic match that finds the two cases where no error code is returned at all is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 90c7afc commit c1e3334

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/net/ethernet/ti/cpsw.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,7 +2427,7 @@ static int cpsw_probe(struct platform_device *pdev)
24272427
ndev->irq = platform_get_irq(pdev, 1);
24282428
if (ndev->irq < 0) {
24292429
dev_err(priv->dev, "error getting irq resource\n");
2430-
ret = -ENOENT;
2430+
ret = ndev->irq;
24312431
goto clean_ale_ret;
24322432
}
24332433

@@ -2448,8 +2448,10 @@ static int cpsw_probe(struct platform_device *pdev)
24482448

24492449
/* RX IRQ */
24502450
irq = platform_get_irq(pdev, 1);
2451-
if (irq < 0)
2451+
if (irq < 0) {
2452+
ret = irq;
24522453
goto clean_ale_ret;
2454+
}
24532455

24542456
priv->irqs_table[0] = irq;
24552457
ret = devm_request_irq(&pdev->dev, irq, cpsw_rx_interrupt,
@@ -2461,8 +2463,10 @@ static int cpsw_probe(struct platform_device *pdev)
24612463

24622464
/* TX IRQ */
24632465
irq = platform_get_irq(pdev, 2);
2464-
if (irq < 0)
2466+
if (irq < 0) {
2467+
ret = irq;
24652468
goto clean_ale_ret;
2469+
}
24662470

24672471
priv->irqs_table[1] = irq;
24682472
ret = devm_request_irq(&pdev->dev, irq, cpsw_tx_interrupt,

0 commit comments

Comments
 (0)