lkml.org 
[lkml]   [2023]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/1] gpu: drm: aspeed: fix value check in aspeed_gfx_load()
From
Le 27/07/2023 à 19:03, Yuanjun Gong a écrit :
> in aspeed_gfx_load(), check the return value of clk_prepare_enable()
> and return the error code if clk_prepare_enable() returns an
> unexpected value.
>
> Fixes: 4f2a8f5898ec ("drm: Add ASPEED GFX driver")
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
> ---
> drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
> index c8c7f8215155..3bfa39bc4f7e 100644
> --- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
> +++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
> @@ -199,7 +199,11 @@ static int aspeed_gfx_load(struct drm_device *drm)
> "missing or invalid clk device tree entry");
> return PTR_ERR(priv->clk);
> }
> - clk_prepare_enable(priv->clk);
> + ret = clk_prepare_enable(priv->clk);
> + if (ret) {
> + dev_err(&pdev->dev, "Failed to enable clock\n");
> + return ret;
> + }
>
> /* Sanitize control registers */
> writel(0, priv->base + CRT_CTRL1);

Hi,

the code also lacks a clk_disable_unprepare() in aspeed_gfx_unload().

So using devm_clk_get_enabled() a few lines above should fix both issue.

CJ

\
 
 \ /
  Last update: 2023-07-27 19:58    [W:0.033 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site