Re: [PATCH v7 05/17] drm/panfrost: Skip NULL checks for clock enable/disabling

From: Boris Brezillon

Date: Tue Sep 01 2026 - 08:44:33 EST


On Fri, 28 Aug 2026 21:56:45 +0100
Adrián Larumbe <adrian.larumbe@xxxxxxxxxxxxx> wrote:

> The clk_* API can deal with NULL clock objects, so we can do away with NULL
> checks in client code.
>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@xxxxxxxxxxxxx>

Reviewed-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>

> ---
> drivers/gpu/drm/panfrost/panfrost_device.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c
> index 6e3fcd53b690..a9d9669912e0 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_device.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.c
> @@ -540,11 +540,9 @@ static int panfrost_device_resume(struct device *dev)
> if (ret)
> goto err_clk;
>
> - if (pfdev->bus_clock) {
> - ret = clk_enable(pfdev->bus_clock);
> - if (ret)
> - goto err_bus_clk;
> - }
> + ret = clk_enable(pfdev->bus_clock);
> + if (ret)
> + goto err_bus_clk;
> }
>
> ret = pm_runtime_force_resume(dev);
> @@ -554,7 +552,7 @@ static int panfrost_device_resume(struct device *dev)
> return 0;
>
> err_resume:
> - if (pfdev->comp->pm_features & BIT(GPU_PM_CLK_DIS) && pfdev->bus_clock)
> + 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))
> @@ -575,9 +573,7 @@ static int panfrost_device_suspend(struct device *dev)
> return ret;
>
> if (pfdev->comp->pm_features & BIT(GPU_PM_CLK_DIS)) {
> - if (pfdev->bus_clock)
> - clk_disable(pfdev->bus_clock);
> -
> + clk_disable(pfdev->bus_clock);
> clk_disable(pfdev->clock);
> }
>
>