mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/exynos: fimd: handle runtime resume failure for DP clock
@ 2026-10-03  8:09 Jiale Yao
  2026-11-09  4:17 ` Inki Dae
  0 siblings, 1 reply; 2+ messages in thread
From: Jiale Yao @ 2026-10-03  8:09 UTC (permalink / raw)
  To: Inki Dae, Seung-Woo Kim, Kyungmin Park, David Airlie,
	Simona Vetter, Krzysztof Kozlowski, Peter Griffin, Alim Akhtar,
	Tomi Valkeinen, Marek Szyprowski, dri-devel, linux-arm-kernel,
	linux-samsung-soc, linux-kernel
  Cc: Jiale Yao

fimd_dp_clock_enable() ignores runtime resume failures and still writes
the DP clock register and updates dp_clk_enabled. This can access an
unavailable device, record a state that was not applied to hardware,
and later drop a runtime PM reference that was never acquired.

Return without changing the clock state when runtime resume fails.

Fixes: 5d91394f2361 ("drm/exynos: fimd: Guard display clock control with runtime PM calls")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index b6abdc4f2b0a..ea2b961f0cbc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -1049,12 +1049,18 @@ static void fimd_dp_clock_enable(struct exynos_drm_clk *clk, bool enable)
 	struct fimd_context *ctx = container_of(clk, struct fimd_context,
 						dp_clk);
 	u32 val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE;
+	int ret;
 
 	if (enable == ctx->dp_clk_enabled)
 		return;
 
-	if (enable)
-		pm_runtime_resume_and_get(ctx->dev);
+	if (enable) {
+		ret = pm_runtime_resume_and_get(ctx->dev);
+		if (ret < 0) {
+			dev_warn(ctx->dev, "failed to enable FIMD device: %d\n", ret);
+			return;
+		}
+	}
 
 	ctx->dp_clk_enabled = enable;
 	writel(val, ctx->regs + DP_MIE_CLKCON);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/exynos: fimd: handle runtime resume failure for DP clock
  2026-10-03  8:09 [PATCH] drm/exynos: fimd: handle runtime resume failure for DP clock Jiale Yao
@ 2026-11-09  4:17 ` Inki Dae
  0 siblings, 0 replies; 2+ messages in thread
From: Inki Dae @ 2026-11-09  4:17 UTC (permalink / raw)
  To: Jiale Yao
  Cc: Seung-Woo Kim, Kyungmin Park, David Airlie, Simona Vetter,
	Krzysztof Kozlowski, Peter Griffin, Alim Akhtar, Tomi Valkeinen,
	Marek Szyprowski, dri-devel, linux-arm-kernel, linux-samsung-soc,
	linux-kernel

HI,

2026년 10월 3일 (토) 오후 5:13, Jiale Yao <yaojiale02@163.com>님이 작성:
>
> fimd_dp_clock_enable() ignores runtime resume failures and still writes
> the DP clock register and updates dp_clk_enabled. This can access an
> unavailable device, record a state that was not applied to hardware,
> and later drop a runtime PM reference that was never acquired.
>
> Return without changing the clock state when runtime resume fails.
>
> Fixes: 5d91394f2361 ("drm/exynos: fimd: Guard display clock control with runtime PM calls")
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index b6abdc4f2b0a..ea2b961f0cbc 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -1049,12 +1049,18 @@ static void fimd_dp_clock_enable(struct exynos_drm_clk *clk, bool enable)
>         struct fimd_context *ctx = container_of(clk, struct fimd_context,
>                                                 dp_clk);
>         u32 val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE;
> +       int ret;
>
>         if (enable == ctx->dp_clk_enabled)
>                 return;
>
> -       if (enable)
> -               pm_runtime_resume_and_get(ctx->dev);
> +       if (enable) {
> +               ret = pm_runtime_resume_and_get(ctx->dev);
> +               if (ret < 0) {
> +                       dev_warn(ctx->dev, "failed to enable FIMD device: %d\n", ret);
> +                       return;
> +               }
> +       }

The early return on runtime resume failure avoids accessing the FIMD
register while the device is unavailable. It also leaves
dp_clk_enabled unchanged, so a later disable will not drop a PM
reference that was never acquired. The change looks good to me.
Merged.

Thanks,
Inki Dae

>
>         ctx->dp_clk_enabled = enable;
>         writel(val, ctx->regs + DP_MIE_CLKCON);
> --
> 2.34.1
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-09  4:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-03  8:09 [PATCH] drm/exynos: fimd: handle runtime resume failure for DP clock Jiale Yao
2026-11-09  4:17 ` Inki Dae

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®