]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
media: staging: lirc_serial: Do not assume error codes returned by request_irq()
authorBen Hutchings <ben@decadent.org.uk>
Wed, 16 Nov 2011 04:54:04 +0000 (01:54 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 12 Mar 2012 19:31:39 +0000 (12:31 -0700)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/lirc/lirc_serial.c

index befe6267d7cbbec4d3e88b127101142f0d02a6eb..1501e4e74ec30db72bfa11cfd3e7382ba769db7c 100644 (file)
@@ -843,18 +843,15 @@ static int __devinit lirc_serial_probe(struct platform_device *dev)
        result = request_irq(irq, irq_handler,
                             (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. */
        /*