The managed delayed-work cancellation is registered before the GPIO, regulator, and extcon resources used by the work. Devres can release those resources while queued work still runs. Register work cancellation after its dependencies but before the IRQ that schedules it. Cleanup then frees the IRQ, cancels the work, and releases the dependent resources. The teardown ordering issue was found by static analysis. Fixes: f94a5becabf4 ("extconn: Clean-up few drivers by using managed work init") Cc: stable@vger.kernel.org Assisted-by: LLM Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak --- drivers/extcon/extcon-intel-int3496.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c index 7d16d5b7d58f..13c585d978f2 100644 --- a/drivers/extcon/extcon-intel-int3496.c +++ b/drivers/extcon/extcon-intel-int3496.c @@ -130,10 +130,6 @@ static int int3496_probe(struct platform_device *pdev) return -ENOMEM; data->dev = dev; - ret = devm_delayed_work_autocancel(dev, &data->work, int3496_do_usb_id); - if (ret) - return ret; - data->gpio_usb_id = devm_gpiod_get(dev, "id", GPIOD_IN | GPIOD_FLAGS_BIT_NONEXCLUSIVE); if (IS_ERR(data->gpio_usb_id)) { @@ -169,6 +165,10 @@ static int int3496_probe(struct platform_device *pdev) return ret; } + ret = devm_delayed_work_autocancel(dev, &data->work, int3496_do_usb_id); + if (ret) + return ret; + ret = devm_request_threaded_irq(dev, data->usb_id_irq, NULL, int3496_thread_isr, IRQF_SHARED | IRQF_ONESHOT |