lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 2 Oct 2021 22:48:45 +0300
From:   Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To:     Xu Wang <vulab@...as.ac.cn>, robdclark@...il.com, sean@...rly.run,
        airlied@...ux.ie, daniel@...ll.ch, jcrouse@...eaurora.org,
        tzimmermann@...e.de, abhinavk@...eaurora.org
Cc:     linux-arm-msm@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        freedreno@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/msm/mdp5: Remove redundant null check before
 clk_prepare_enable/clk_disable_unprepare

On 31/12/2020 12:49, Xu Wang wrote:
> Because clk_prepare_enable() and clk_disable_unprepare() already checked
> NULL clock parameter, so the additional checks are unnecessary, just
> remove them.
> 
> Signed-off-by: Xu Wang <vulab@...as.ac.cn>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>

> ---
>   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 18 ++++++------------
>   drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c | 12 ++++--------
>   2 files changed, 10 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> index 15aed45022bc..8d373d2ffd51 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> @@ -303,15 +303,12 @@ static int mdp5_disable(struct mdp5_kms *mdp5_kms)
>   	mdp5_kms->enable_count--;
>   	WARN_ON(mdp5_kms->enable_count < 0);
>   
> -	if (mdp5_kms->tbu_rt_clk)
> -		clk_disable_unprepare(mdp5_kms->tbu_rt_clk);
> -	if (mdp5_kms->tbu_clk)
> -		clk_disable_unprepare(mdp5_kms->tbu_clk);
> +	clk_disable_unprepare(mdp5_kms->tbu_rt_clk);
> +	clk_disable_unprepare(mdp5_kms->tbu_clk);
>   	clk_disable_unprepare(mdp5_kms->ahb_clk);
>   	clk_disable_unprepare(mdp5_kms->axi_clk);
>   	clk_disable_unprepare(mdp5_kms->core_clk);
> -	if (mdp5_kms->lut_clk)
> -		clk_disable_unprepare(mdp5_kms->lut_clk);
> +	clk_disable_unprepare(mdp5_kms->lut_clk);
>   
>   	return 0;
>   }
> @@ -325,12 +322,9 @@ static int mdp5_enable(struct mdp5_kms *mdp5_kms)
>   	clk_prepare_enable(mdp5_kms->ahb_clk);
>   	clk_prepare_enable(mdp5_kms->axi_clk);
>   	clk_prepare_enable(mdp5_kms->core_clk);
> -	if (mdp5_kms->lut_clk)
> -		clk_prepare_enable(mdp5_kms->lut_clk);
> -	if (mdp5_kms->tbu_clk)
> -		clk_prepare_enable(mdp5_kms->tbu_clk);
> -	if (mdp5_kms->tbu_rt_clk)
> -		clk_prepare_enable(mdp5_kms->tbu_rt_clk);
> +	clk_prepare_enable(mdp5_kms->lut_clk);
> +	clk_prepare_enable(mdp5_kms->tbu_clk);
> +	clk_prepare_enable(mdp5_kms->tbu_rt_clk);
>   
>   	return 0;
>   }
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c
> index 09bd46ad820b..02c6c4b68c68 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c
> @@ -137,10 +137,8 @@ static int mdp5_mdss_enable(struct msm_mdss *mdss)
>   	DBG("");
>   
>   	clk_prepare_enable(mdp5_mdss->ahb_clk);
> -	if (mdp5_mdss->axi_clk)
> -		clk_prepare_enable(mdp5_mdss->axi_clk);
> -	if (mdp5_mdss->vsync_clk)
> -		clk_prepare_enable(mdp5_mdss->vsync_clk);
> +	clk_prepare_enable(mdp5_mdss->axi_clk);
> +	clk_prepare_enable(mdp5_mdss->vsync_clk);
>   
>   	return 0;
>   }
> @@ -150,10 +148,8 @@ static int mdp5_mdss_disable(struct msm_mdss *mdss)
>   	struct mdp5_mdss *mdp5_mdss = to_mdp5_mdss(mdss);
>   	DBG("");
>   
> -	if (mdp5_mdss->vsync_clk)
> -		clk_disable_unprepare(mdp5_mdss->vsync_clk);
> -	if (mdp5_mdss->axi_clk)
> -		clk_disable_unprepare(mdp5_mdss->axi_clk);
> +	clk_disable_unprepare(mdp5_mdss->vsync_clk);
> +	clk_disable_unprepare(mdp5_mdss->axi_clk);
>   	clk_disable_unprepare(mdp5_mdss->ahb_clk);
>   
>   	return 0;
> 


-- 
With best wishes
Dmitry

Powered by blists - more mailing lists