linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: netdev@vger.kernel.org, wg@grandegger.com, mkl@pengutronix.de,
	linux-can@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Subject: [PATCH 1/3] rcar_can: fix IRQ check
Date: Sat, 20 Jun 2015 00:32:46 +0000	[thread overview]
Message-ID: <1788456.ArSzxG6No3@wasted.cogentembedded.com> (raw)
In-Reply-To: <2010452.WyFito6egU@wasted.cogentembedded.com>

rcar_can_probe() regards 0 as a wrong IRQ #, despite platform_get_irq() that it
calls returns negative error code in that case. This leads to the following
being printed to the console when attempting to open the device:

error requesting interrupt fffffffa

because  rcar_can_open() calls request_irq() with a negative IRQ #, and that
function naturally fails with -EINVAL.

Check for the negative error codes instead and propagate them upstream instead
of just returning -ENODEV.

Fixes: fd1159318e55 ("can: add Renesas R-Car CAN driver")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/net/can/rcar_can.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-can/drivers/net/can/rcar_can.c
=================================--- linux-can.orig/drivers/net/can/rcar_can.c
+++ linux-can/drivers/net/can/rcar_can.c
@@ -758,8 +758,9 @@ static int rcar_can_probe(struct platfor
 	}
 
 	irq = platform_get_irq(pdev, 0);
-	if (!irq) {
+	if (irq < 0) {
 		dev_err(&pdev->dev, "No IRQ resource\n");
+		err = irq;
 		goto fail;
 	}
 

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in

  reply	other threads:[~2015-06-20  0:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-20  0:30 [PATCH 0/3] Small fixes for Renesas R-Car CAN driver Sergei Shtylyov
2015-06-20  0:32 ` Sergei Shtylyov [this message]
2015-06-20  0:33 ` [PATCH 2/3] rcar_can: print signed IRQ # Sergei Shtylyov
2015-06-20 12:03   ` Geert Uytterhoeven
2015-06-20 14:38     ` Sergei Shtylyov
2015-06-20 16:02       ` Marc Kleine-Budde
2015-06-20 16:25         ` Sergei Shtylyov
2015-06-20  0:34 ` [PATCH 3/3] rcar_can: fix typo in error message Sergei Shtylyov

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=1788456.ArSzxG6No3@wasted.cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.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).