[lvc-project] [PATCH] gpu: cdns-mhdp8546: fix call balance of mhdp->clk handling routines

Dmitry Baryshkov dmitry.baryshkov at linaro.org
Mon Jan 27 00:46:32 MSK 2025


On Fri, Jan 24, 2025 at 08:00:09PM +0300, Vitalii Mordan wrote:
> If the clock mhdp->clk was not enabled in cdns_mhdp_probe(), it should not
> be disabled in any path.
> 
> Found by Linux Verification Center (linuxtesting.org) with Klever.
> 
> Fixes: fb43aa0acdfd ("drm: bridge: Add support for Cadence MHDP8546 DPI/DP bridge")
> Signed-off-by: Vitalii Mordan <mordan at ispras.ru>
> ---
>  drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
> index d081850e3c03..3e923bcfb0bf 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
> @@ -2504,7 +2504,11 @@ static int cdns_mhdp_probe(struct platform_device *pdev)
>  
>  	mhdp->info = of_device_get_match_data(dev);
>  
> -	clk_prepare_enable(clk);
> +	ret = clk_prepare_enable(clk);
> +	if (ret) {
> +		dev_err(dev, "Failed to enable clk\n");
> +		return ret;
> +	}

I think this should be switch to devm_clk_get_enabled, removing the
extra clk_prepare_enable(), error handling, etc.

>  
>  	pm_runtime_enable(dev);
>  	ret = pm_runtime_resume_and_get(dev);
> -- 
> 2.25.1
> 

-- 
With best wishes
Dmitry



More information about the lvc-project mailing list