Commit d6bc69349915e2d58499165851a17280c97126ac

Authored by Ben Hutchings
Committed by Greg Kroah-Hartman
1 parent 47cd23fd08

media: staging: lirc_serial: Do not assume error codes returned by request_irq()

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>

Showing 1 changed file with 9 additions and 12 deletions Side-by-side Diff

drivers/staging/media/lirc/lirc_serial.c
... ... @@ -843,18 +843,15 @@
843 843 result = request_irq(irq, irq_handler,
844 844 (share_irq ? IRQF_SHARED : 0),
845 845 LIRC_DRIVER_NAME, (void *)&hardware);
846   -
847   - switch (result) {
848   - case -EBUSY:
849   - printk(KERN_ERR LIRC_DRIVER_NAME ": IRQ %d busy\n", irq);
850   - return -EBUSY;
851   - case -EINVAL:
852   - printk(KERN_ERR LIRC_DRIVER_NAME
853   - ": Bad irq number or handler\n");
854   - return -EINVAL;
855   - default:
856   - break;
857   - };
  846 + if (result < 0) {
  847 + if (result == -EBUSY)
  848 + printk(KERN_ERR LIRC_DRIVER_NAME ": IRQ %d busy\n",
  849 + irq);
  850 + else if (result == -EINVAL)
  851 + printk(KERN_ERR LIRC_DRIVER_NAME
  852 + ": Bad irq number or handler\n");
  853 + return result;
  854 + }
858 855  
859 856 /* Reserve io region. */
860 857 /*