Message ID | 20200427145414.121700-1-hdegoede@redhat.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Marcel Holtmann |
Headers | show |
Series | Bluetooth: btbcm: Do not free IRQ on close if we did not request it | expand |
Hi Hans, > When the patch-ram is missing the hci_bcm code does not request the > IRQ, in this case we should not try to free it from bcm_close() > > This fixes the following WARN statements + backtraces: > [ 332.670662] WARNING: CPU: 3 PID: 4743 at kernel/irq/devres.c:143 devm_free_irq+0x45/0x50 > [ 332.670882] Trying to free already-free IRQ 44 > [ 332.670891] WARNING: CPU: 3 PID: 4743 at kernel/irq/manage.c:1718 free_irq+0x1f4/0x390 > > Signed-off-by: Hans de Goede <hdegoede@redhat.com> > --- > drivers/bluetooth/hci_bcm.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) the patch doesn’t apply cleanly against bluetooth-next tree. Can you send a revised one. Thanks. Regards Marcel
Hi, On 4/28/20 11:39 AM, Marcel Holtmann wrote: > Hi Hans, > >> When the patch-ram is missing the hci_bcm code does not request the >> IRQ, in this case we should not try to free it from bcm_close() >> >> This fixes the following WARN statements + backtraces: >> [ 332.670662] WARNING: CPU: 3 PID: 4743 at kernel/irq/devres.c:143 devm_free_irq+0x45/0x50 >> [ 332.670882] Trying to free already-free IRQ 44 >> [ 332.670891] WARNING: CPU: 3 PID: 4743 at kernel/irq/manage.c:1718 free_irq+0x1f4/0x390 >> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com> >> --- >> drivers/bluetooth/hci_bcm.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) > > the patch doesn’t apply cleanly against bluetooth-next tree. Can you send a revised one. Thanks. So I looked into rebasing the patch and it did not apply because another (almost identical) fix for the issue has already landed in bluetooth-next: d5d0c62437c0 ("Bluetooth: hci_bcm: fix freeing not-requested IRQ") So my version of this fix (this patch) can be dropped. It would be good if this straight forward fix can be send to Linus for one of the upcoming 5.7-rc# releases. Regards, Hans
diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index 0c34b6c57f7d..0fb4b9c1dfc1 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -118,6 +118,7 @@ struct bcm_device { u32 oper_speed; int irq; bool irq_active_low; + bool irq_requested; #ifdef CONFIG_PM struct hci_uart *hu; @@ -333,6 +334,8 @@ static int bcm_request_irq(struct bcm_data *bcm) goto unlock; } + bdev->irq_requested = true; + device_init_wakeup(bdev->dev, true); pm_runtime_set_autosuspend_delay(bdev->dev, @@ -514,10 +517,11 @@ static int bcm_close(struct hci_uart *hu) } if (bdev) { - if (IS_ENABLED(CONFIG_PM) && bdev->irq > 0) { + if (bdev->irq_requested) { devm_free_irq(bdev->dev, bdev->irq, bdev); device_init_wakeup(bdev->dev, false); pm_runtime_disable(bdev->dev); + bdev->irq_requested = false; } err = bcm_gpio_set_power(bdev, false);
When the patch-ram is missing the hci_bcm code does not request the IRQ, in this case we should not try to free it from bcm_close() This fixes the following WARN statements + backtraces: [ 332.670662] WARNING: CPU: 3 PID: 4743 at kernel/irq/devres.c:143 devm_free_irq+0x45/0x50 [ 332.670882] Trying to free already-free IRQ 44 [ 332.670891] WARNING: CPU: 3 PID: 4743 at kernel/irq/manage.c:1718 free_irq+0x1f4/0x390 Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/bluetooth/hci_bcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)