Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] Resource teardown order mismatch between init error path and fini()
--

commit cc1a89616a9fe7ee1baf348443aab4d77f011c53
Author: Adrián Larumbe <[email protected]>
drm/panfrost: Move all DRM device initialisation into device_init()

This commit moves all DRM device initialization and registration into
panfrost_device_init() so the probe function can be minimal. It also
adjusts panfrost_remove() to rely on panfrost_device_fini() for resource
cleanup.

> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c 
> b/drivers/gpu/drm/panfrost/panfrost_device.c
> index 50f4713bfcfdd..a6deabb39fd2c 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_device.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.c
[ ... ]
>  void panfrost_device_fini(struct panfrost_device *pfdev)
>  {
> +     pm_runtime_get_sync(pfdev->base.dev);
> +
> +     pm_runtime_dont_use_autosuspend(pfdev->base.dev);
> +     pm_runtime_disable(pfdev->base.dev);
> +
>       panfrost_gem_fini(pfdev);
>       panfrost_perfcnt_fini(pfdev);
>       panfrost_jm_fini(pfdev);
> @@ -354,6 +400,9 @@ void panfrost_device_fini(struct panfrost_device *pfdev)
>       panfrost_clk_fini(pfdev);
>       panfrost_reset_fini(pfdev);
>       panfrost_pm_domain_fini(pfdev);

[Severity: Medium]
Is there a resource teardown order mismatch here?

In panfrost_device_init(), devfreq is initialized before regulators, and its
error path correctly tears down regulators before devfreq:

panfrost_device_init() {
    ...
out_regulator:
    panfrost_regulator_fini(pfdev);
out_devfreq:
    panfrost_devfreq_fini(pfdev);
    ...
}

However, in panfrost_device_fini(), panfrost_devfreq_fini() is called before
panfrost_regulator_fini() (just above panfrost_clk_fini()).

Could this create an issue during device removal by not following the strict
reverse-initialization order used in the init error path?

> +
> +     pm_runtime_set_suspended(pfdev->base.dev);
> +     pm_runtime_put_noidle(pfdev->base.dev);
>  }

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=8

Reply via email to