Re: [PATCH] drm/imx: dcss: fix autosuspend cleanup during teardown

Laurentiu Palcu <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,dev.linux.lists.imx,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-arm-kernel,org.kernel.vger.stable
Message-ID <iqr75sl6j5g3lkfoj3jeznaqsm55bl3qciwujivwm7mvgefvil@my2gr2rrsqcz>
Hi Guangshuo,

On Sat, Aug 08, 2026 at 08:23:54PM +0800, Guangshuo Li wrote:
> dcss_dev_create() calls pm_runtime_use_autosuspend(), but
> dcss_dev_destroy() does not call the matching
> pm_runtime_dont_use_autosuspend() before disabling runtime PM.
> 
> If the autosuspend delay is set to a negative value while autosuspend
> is enabled, the runtime PM core increments usage_count to prevent
> runtime suspend. Without calling pm_runtime_dont_use_autosuspend()
> during teardown, this reference is not dropped and usage_count remains
> unbalanced.
> 
> The documentation for pm_runtime_use_autosuspend() also notes that it
> is important to undo it with pm_runtime_dont_use_autosuspend() at
> driver exit time, unless runtime PM was initially enabled with
> devm_pm_runtime_enable().
> 
> Add the missing pm_runtime_dont_use_autosuspend() call before
> disabling runtime PM during device teardown.
> 
> This issue was found by manual code inspection.
> 
> Fixes: 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ")
> Cc: [email protected]
> Signed-off-by: Guangshuo Li <[email protected]>
> ---
>  drivers/gpu/drm/imx/dcss/dcss-dev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.c b/drivers/gpu/drm/imx/dcss/dcss-dev.c
> index 7fd0c4c14205..51398852cdc2 100644
> --- a/drivers/gpu/drm/imx/dcss/dcss-dev.c
> +++ b/drivers/gpu/drm/imx/dcss/dcss-dev.c
> @@ -240,6 +240,7 @@ void dcss_dev_destroy(struct dcss_dev *dcss)
>  
>  	of_node_put(dcss->of_port);
>  
> +	pm_runtime_dont_use_autosuspend(dcss->dev);

This will call rpm_idle(), which will call dcss_dev_runtime_suspend(). So
you'll end up calling dcss_clocks_disable() twice... :/

>  	pm_runtime_disable(dcss->dev);
>  
>  	dcss_submodules_stop(dcss);
> -- 
> 2.43.0
> 

-- 
Thanks,
Laurentiu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.