Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] Missing clock disable/unprepare for `pfdev->clock` in the error path 
of `panfrost_device_resume()`.
--

commit 57e1cc8c0bd76260d5e27d81a245c42e7661aa0a
Author: Adrián Larumbe <[email protected]>

drm/panfrost: Consolidate device clock management and reset

This commit gathers clock enables and disables into a single function to
avoid repetitions between driver init/fini and device resume/suspend. It
also groups clk prepares and enables into the same function calls.

> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c 
> b/drivers/gpu/drm/panfrost/panfrost_device.c
> index b3a53504bd016..2fcbd223204c4 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_device.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.c
[ ... ]
> @@ -506,13 +501,9 @@ static int panfrost_device_resume(struct device *dev)
>       }
>  
>       if (pfdev->comp->pm_features & BIT(GPU_PM_CLK_DIS)) {
> -             ret = clk_enable(pfdev->clock);
> +             ret = panfrost_clk_enable(pfdev, false);
>               if (ret)
>                       goto err_clk;
> -
> -             ret = clk_enable(pfdev->bus_clock);
> -             if (ret)
> -                     goto err_bus_clk;
>       }
>  
>       ret = pm_runtime_force_resume(dev);
> @@ -523,10 +514,7 @@ static int panfrost_device_resume(struct device *dev)
>  
>  err_resume:
>       if (pfdev->comp->pm_features & BIT(GPU_PM_CLK_DIS))
> -             clk_disable(pfdev->bus_clock);
> -err_bus_clk:
> -     if (pfdev->comp->pm_features & BIT(GPU_PM_CLK_DIS))
> -             clk_disable(pfdev->clock);
> +             clk_disable_unprepare(pfdev->bus_clock);
>  err_clk:

[Severity: Medium]
When pm_runtime_force_resume() fails and jumps to err_resume, does this code
leak the clock preparation and enable reference counts for pfdev->clock?

Because panfrost_clk_enable(pfdev, false) prepares and enables both
pfdev->clock and pfdev->bus_clock, disabling only pfdev->bus_clock here
seems to leave pfdev->clock enabled. Should panfrost_clk_disable(pfdev,
false) be used on this path instead?

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

Reply via email to