Skip to content

Commit

Permalink
can: flexcan: fix the return value handle for platform_get_irq()
Browse files Browse the repository at this point in the history
There is no possible for platform_get_irq() to return 0
and the return value of platform_get_irq() is more sensible
to show the error reason.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/all/20230731075252.359965-1-ruanjinjie@huawei.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Ruan Jinjie authored and Marc Kleine-Budde committed Jul 31, 2023
1 parent 2b3082c commit 53b8d2b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/net/can/flexcan/flexcan-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2089,8 +2089,8 @@ static int flexcan_probe(struct platform_device *pdev)
}

irq = platform_get_irq(pdev, 0);
if (irq <= 0)
return -ENODEV;
if (irq < 0)
return irq;

regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(regs))
Expand Down Expand Up @@ -2167,13 +2167,13 @@ static int flexcan_probe(struct platform_device *pdev)

if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_IRQ_3) {
priv->irq_boff = platform_get_irq(pdev, 1);
if (priv->irq_boff <= 0) {
err = -ENODEV;
if (priv->irq_boff < 0) {
err = priv->irq_boff;
goto failed_platform_get_irq;
}
priv->irq_err = platform_get_irq(pdev, 2);
if (priv->irq_err <= 0) {
err = -ENODEV;
if (priv->irq_err < 0) {
err = priv->irq_err;
goto failed_platform_get_irq;
}
}
Expand Down

0 comments on commit 53b8d2b

Please sign in to comment.