Bluetooth: hci_bcm: Invalidate IRQ on request failure
authorLukas Wunner <lukas@wunner.de>
Wed, 10 Jan 2018 15:32:10 +0000 (16:32 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Fri, 14 Dec 2018 10:04:15 +0000 (11:04 +0100)
If devm_request_irq() fails, the driver bails out of bcm_request_irq()
but continues to ->setup the device (because the IRQ is optional).

The driver subsequently calls devm_free_irq(), enable_irq_wake() and
disable_irq_wake() on the IRQ even though requesting it failed.

Avoid by invalidating the IRQ on request failure.

Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/hci_bcm.c

index b949cde2a6781527004d0fb45492472a42216c52..37c7158b2443e263764d48b57a10f4c14600aa7c 100644 (file)
@@ -214,8 +214,10 @@ static int bcm_request_irq(struct bcm_data *bcm)
                               bdev->irq_active_low ? IRQF_TRIGGER_FALLING :
                                                      IRQF_TRIGGER_RISING,
                               "host_wake", bdev);
-       if (err)
+       if (err) {
+               bdev->irq = err;
                goto unlock;
+       }
 
        device_init_wakeup(bdev->dev, true);