All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
	Jarod Wilson <jarod@redhat.com>,
	Torsten Crass <torsten.crass@eBiology.de>
Subject: [PATCH 4/4] [media] staging: lirc_serial: Do not assume error codes returned by request_irq()
Date: Fri, 2 Mar 2012 14:41:49 -0600	[thread overview]
Message-ID: <20120302204149.GE22323@burratino> (raw)
In-Reply-To: <20120302203913.GA22323@burratino>

From: Ben Hutchings <ben@decadent.org.uk>
Date: Wed, 16 Nov 2011 01:54:04 -0300

commit affc9a0d59ac49bd304e2137bd5e4ffdd6fdfa52 upstream.

lirc_serial_probe() must fail if request_irq() returns an error, even if
it isn't EBUSY or EINVAL,

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 drivers/staging/lirc/lirc_serial.c |   21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lirc/lirc_serial.c b/drivers/staging/lirc/lirc_serial.c
index 4b8fefb954d3..21cbc9ae79c9 100644
--- a/drivers/staging/lirc/lirc_serial.c
+++ b/drivers/staging/lirc/lirc_serial.c
@@ -843,18 +843,15 @@ static int __devinit lirc_serial_probe(struct platform_device *dev)
 	result = request_irq(irq, irq_handler,
 			     IRQF_DISABLED | (share_irq ? IRQF_SHARED : 0),
 			     LIRC_DRIVER_NAME, (void *)&hardware);
-
-	switch (result) {
-	case -EBUSY:
-		printk(KERN_ERR LIRC_DRIVER_NAME ": IRQ %d busy\n", irq);
-		return -EBUSY;
-	case -EINVAL:
-		printk(KERN_ERR LIRC_DRIVER_NAME
-		       ": Bad irq number or handler\n");
-		return -EINVAL;
-	default:
-		break;
-	};
+	if (result < 0) {
+		if (result == -EBUSY)
+			printk(KERN_ERR LIRC_DRIVER_NAME ": IRQ %d busy\n",
+			       irq);
+		else if (result == -EINVAL)
+			printk(KERN_ERR LIRC_DRIVER_NAME
+			       ": Bad irq number or handler\n");
+		return result;
+	}
 
 	/* Reserve io region. */
 	/*
-- 
1.7.9.2


  parent reply	other threads:[~2012-03-02 20:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-16  5:49 [PATCH 1/5] staging: lirc_serial: Fix init/exit order Ben Hutchings
2011-11-16  5:52 ` [PATCH 2/5] staging: lirc_serial: Free resources on failure paths of lirc_serial_probe() Ben Hutchings
2011-11-16  5:53 ` [PATCH 3/5] staging: lirc_serial: Fix deadlock on resume failure Ben Hutchings
2011-11-16  5:53 ` [PATCH 4/5] staging: lirc_serial: Fix bogus error codes Ben Hutchings
2011-11-16  5:54 ` [PATCH 5/5] staging: lirc_serial: Do not assume error codes returned by request_irq() Ben Hutchings
2012-03-02  3:45 ` [PATCH 1/5] staging: lirc_serial: Fix init/exit order Jonathan Nieder
2012-03-02  4:35   ` Ben Hutchings
2012-03-02  5:29     ` VDR User
2012-03-02 20:39     ` [PATCH 3.0.y 0/4] Re: lirc_serial spuriously claims assigned port and irq to be in use Jonathan Nieder
2012-03-02 20:40       ` [PATCH 1/4] [media] staging: lirc_serial: Fix init/exit order Jonathan Nieder
2012-03-02 20:40       ` [PATCH 2/4] [media] staging: lirc_serial: Free resources on failure paths of lirc_serial_probe() Jonathan Nieder
2012-03-02 20:41       ` [PATCH 3/4] [media] staging: lirc_serial: Fix deadlock on resume failure Jonathan Nieder
2012-03-02 20:41       ` Jonathan Nieder [this message]
2012-03-02 21:13       ` [PATCH 3.0.y 0/4] Re: lirc_serial spuriously claims assigned port and irq to be in use Greg Kroah-Hartman
2012-03-03  1:13         ` Jonathan Nieder
2012-03-07 20:04       ` Greg Kroah-Hartman
2012-03-07 20:17         ` Jonathan Nieder
2012-03-08 18:34           ` Greg Kroah-Hartman
2012-03-07 21:34         ` Ben Hutchings

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=20120302204149.GE22323@burratino \
    --to=jrnieder@gmail.com \
    --cc=ben@decadent.org.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jarod@redhat.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=torsten.crass@eBiology.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.