[PATCH] Bluetooth: btmtksdio: Do not fail probe on wakeup init failure
Gongwei Li <[email protected]>
| Newsgroups | org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-mediatek,org.kernel.vger.linux-bluetooth,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Gongwei Li <[email protected]> devm_device_init_wakeup() merely marks the device as wakeup-capable; it is only consulted later through device_may_wakeup() in the ->wakeup callback to decide whether wake-on-bluetooth can be used. When it fails, the controller itself still works normally and only the ability to wake up the system is lost. Therefore the failure is not fatal for probe(), which is why the existing code only logs the error instead of bailing out. However, the negative error code returned by devm_device_init_wakeup() is never cleared, so if the subsequent devm_gpiod_get_optional() succeeds, probe() ends up returning the stale error even though probing actually succeeded and the HCI device has already been registered. The SDIO core then wrongly treats the function as broken and unbinds the driver. Make the non-fatal semantics explicit: clear the error after logging it and keep probing. Fixes: ce64b3e94919 ("Bluetooth: mt7921s: Support wake on bluetooth") Signed-off-by: Gongwei Li <[email protected]> --- drivers/bluetooth/btmtksdio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c index 63d81341bd94..c918202f6c3a 100644 --- a/drivers/bluetooth/btmtksdio.c +++ b/drivers/bluetooth/btmtksdio.c @@ -1454,8 +1454,11 @@ static int btmtksdio_probe(struct sdio_func *func, pm_runtime_put_noidle(bdev->dev); err = devm_device_init_wakeup(bdev->dev); - if (err) + if (err) { + /* failure is not fatal, keep probing */ bt_dev_err(hdev, "failed to initialize device wakeup"); + err = 0; + } restore_node = false; if (!of_device_is_compatible(bdev->dev->of_node, "mediatek,mt7921s-bluetooth")) { -- 2.25.1