2020-10-19 10:20:07

by Tian Tao

[permalink] [raw]
Subject: [PATCH] drm/msm: Remove redundant null check

clk_prepare_enable() and clk_disable_unprepare() will check
NULL clock parameter, so It is not necessary to add additional checks.

Signed-off-by: Tian Tao <[email protected]>
---
drivers/gpu/drm/msm/msm_gpu.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 57ddc94..25bc654 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -175,15 +175,12 @@ static int disable_clk(struct msm_gpu *gpu)

static int enable_axi(struct msm_gpu *gpu)
{
- if (gpu->ebi1_clk)
- clk_prepare_enable(gpu->ebi1_clk);
- return 0;
+ return clk_prepare_enable(gpu->ebi1_clk);
}

static int disable_axi(struct msm_gpu *gpu)
{
- if (gpu->ebi1_clk)
- clk_disable_unprepare(gpu->ebi1_clk);
+ clk_disable_unprepare(gpu->ebi1_clk);
return 0;
}

--
2.7.4


2020-10-19 14:51:53

by Jordan Crouse

[permalink] [raw]
Subject: Re: [Freedreno] [PATCH] drm/msm: Remove redundant null check

On Mon, Oct 19, 2020 at 02:04:22PM +0800, Tian Tao wrote:
> clk_prepare_enable() and clk_disable_unprepare() will check
> NULL clock parameter, so It is not necessary to add additional checks.

Reviewed-by: Jordan Crouse <[email protected]>

> Signed-off-by: Tian Tao <[email protected]>
> ---
> drivers/gpu/drm/msm/msm_gpu.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
> index 57ddc94..25bc654 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.c
> +++ b/drivers/gpu/drm/msm/msm_gpu.c
> @@ -175,15 +175,12 @@ static int disable_clk(struct msm_gpu *gpu)
>
> static int enable_axi(struct msm_gpu *gpu)
> {
> - if (gpu->ebi1_clk)
> - clk_prepare_enable(gpu->ebi1_clk);
> - return 0;
> + return clk_prepare_enable(gpu->ebi1_clk);
> }
>
> static int disable_axi(struct msm_gpu *gpu)
> {
> - if (gpu->ebi1_clk)
> - clk_disable_unprepare(gpu->ebi1_clk);
> + clk_disable_unprepare(gpu->ebi1_clk);
> return 0;
> }
>
> --
> 2.7.4
>
> _______________________________________________
> Freedreno mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/freedreno

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project