Re: [PATCH 1/2] drm/arm/malidp: fix ignored clk_prepare_enable() in runtime PM resume
From: Liviu Dudau
Date: Fri Jun 05 2026 - 10:26:24 EST
On Sun, May 31, 2026 at 05:29:57AM +0000, Gustavo Kenji Mendonça Kaneko wrote:
> malidp_runtime_pm_resume() calls clk_prepare_enable() three times
> without checking the return value. If any clock fails to enable, the
> driver silently proceeds with unclocked hardware, leading to undefined
> behavior.
>
> Use clk_bulk_prepare_enable() which atomically enables all clocks and
> automatically rolls back successfully enabled clocks on failure. This
> is consistent with how the suspend path already uses
> clk_bulk_disable_unprepare() in malidp_runtime_pm_suspend().
I can't see where you can find other calls to clk_buld_xxxx() in the malidp
code. What sort of code review have you done here?
Best regards,
Liviu
>
> This issue was found by code review without access to Mali DP hardware.
>
> Signed-off-by: Gustavo Kenji Mendonça Kaneko <kaneko.dev@xxxxx>
> ---
> drivers/gpu/drm/arm/malidp_drv.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index b765f6c9eea4..1e4336c3a2fa 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -689,10 +689,17 @@ static int malidp_runtime_pm_resume(struct device *dev)
> struct drm_device *drm = dev_get_drvdata(dev);
> struct malidp_drm *malidp = drm_to_malidp(drm);
> struct malidp_hw_device *hwdev = malidp->dev;
> + struct clk_bulk_data clks[] = {
> + { .clk = hwdev->pclk },
> + { .clk = hwdev->aclk },
> + { .clk = hwdev->mclk },
> + };
> + int err;
> +
> + err = clk_bulk_prepare_enable(ARRAY_SIZE(clks), clks);
> + if (err)
> + return err;
>
> - clk_prepare_enable(hwdev->pclk);
> - clk_prepare_enable(hwdev->aclk);
> - clk_prepare_enable(hwdev->mclk);
> hwdev->pm_suspended = false;
> malidp_de_irq_hw_init(hwdev);
> malidp_se_irq_hw_init(hwdev);
> --
> 2.54.0
>
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯