Re: [PATCH] media: atomisp: drain assert recovery before tearing down resources

From: Andy Shevchenko

Date: Mon Oct 12 2026 - 05:23:21 EST


On Mon, Oct 12, 2026 at 12:21 PM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
> On Mon, Oct 12, 2026 at 7:47 AM Myeonghun Pak <mhun512@xxxxxxxxx> wrote:
> >
> > The threaded IRQ queues assert_recovery_work, which can stop, reset and
> > restart CSS. Removal currently tears down CSS and the CPU latency QoS
> > request while recovery can still be running.
> >
> > Disable and drain recovery before atomisp_pm_uninit(), keeping the IRQ
> > available until recovery finishes. Then release the IRQ before CSS and
> > firmware teardown. Apply the same ordering on probe failure, and skip
> > the uninitialized recovery work in PM-only mode.
> >
> > This issue was found by static analysis.
>
> Nice, have you read the code that you sent?

Next time, please also test this on real HW.

...

> > error_unload_firmware:
> > + disable_work_sync(&isp->assert_recovery_work);
> > atomisp_pm_uninit(isp);
> > + devm_free_irq(&pdev->dev, pdev->irq, isp);
>
> ^^^
>
> > ia_css_unload_firmware();
> > + goto error_unregister_entities;
> > error_free_irq:
> > + disable_work_sync(&isp->assert_recovery_work);
> > devm_free_irq(&pdev->dev, pdev->irq, isp);
>
> ^^^
>
> > error_unregister_entities:
> > hmm_cleanup();

--
With Best Regards,
Andy Shevchenko