extcon: int3496: cancel ID work before releasing dependencies
Subsystems (2)
PATCH 1/1 extcon: int3496: cancel ID work before releasing dependencies
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")
Assisted-by LLM
Co-developed-by Ijae Kim <[email protected]>
Signed-off-by Ijae Kim <[email protected]>
Signed-off-by Myeonghun Pak <[email protected]>
--- drivers/extcon/extcon-intel-int3496.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/extcon/extcon-intel-int3496.c +4 -4
@@ -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 |