netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
	kernel@pengutronix.de, Ruan Jinjie <ruanjinjie@huawei.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH net-next 1/9] can: flexcan: fix the return value handle for platform_get_irq()
Date: Thu,  3 Aug 2023 10:08:22 +0200	[thread overview]
Message-ID: <20230803080830.1386442-2-mkl@pengutronix.de> (raw)
In-Reply-To: <20230803080830.1386442-1-mkl@pengutronix.de>

From: Ruan Jinjie <ruanjinjie@huawei.com>

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>
---
 drivers/net/can/flexcan/flexcan-core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index 48273d51f271..add39e922b89 100644
--- a/drivers/net/can/flexcan/flexcan-core.c
+++ b/drivers/net/can/flexcan/flexcan-core.c
@@ -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))
@@ -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;
 		}
 	}

base-commit: 2b3082c6ef3b0104d822f6f18d2afbe5fc9a5c2c
-- 
2.40.1



  reply	other threads:[~2023-08-03  8:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03  8:08 [PATCH net-next 0/9] pull-request: can-next 2023-08-03 Marc Kleine-Budde
2023-08-03  8:08 ` Marc Kleine-Budde [this message]
2023-08-04  7:50   ` [PATCH net-next 1/9] can: flexcan: fix the return value handle for platform_get_irq() patchwork-bot+netdevbpf
2023-08-03  8:08 ` [PATCH net-next 2/9] dt-bindings: can: tcan4x5x: Add tcan4552 and tcan4553 variants Marc Kleine-Budde
2023-08-03  8:08 ` [PATCH net-next 3/9] can: tcan4x5x: Remove reserved register 0x814 from writable table Marc Kleine-Budde
2023-08-03  8:08 ` [PATCH net-next 4/9] can: tcan4x5x: Check size of mram configuration Marc Kleine-Budde
2023-08-03  8:08 ` [PATCH net-next 5/9] can: tcan4x5x: Rename ID registers to match datasheet Marc Kleine-Budde
2023-08-03  8:08 ` [PATCH net-next 6/9] can: tcan4x5x: Add support for tcan4552/4553 Marc Kleine-Budde
2023-08-03  8:08 ` [PATCH net-next 7/9] can: tcan4x5x: Add error messages in probe Marc Kleine-Budde
2023-08-03  8:08 ` [PATCH net-next 8/9] can: c_can: Do not check for 0 return after calling platform_get_irq() Marc Kleine-Budde
2023-08-03  8:08 ` [PATCH net-next 9/9] can: esd_usb: Add support for esd CAN-USB/3 Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230803080830.1386442-2-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ruanjinjie@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).