Guo Zhengkui
2022-May-19 07:29 UTC
[Nouveau] [PATCH] drm/nouveau/tegra: remove needless NULL check
There has already been NULL check in clk_prepare_enable() and clk_disable_unprepare(), so remove needless NULL check before calling them. Signed-off-by: Guo Zhengkui <guozhengkui at vivo.com> --- drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c index 2ed528c065fa..ac9e122586bc 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c @@ -41,11 +41,9 @@ nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev) ret = clk_prepare_enable(tdev->clk); if (ret) goto err_clk; - if (tdev->clk_ref) { - ret = clk_prepare_enable(tdev->clk_ref); - if (ret) - goto err_clk_ref; - } + ret = clk_prepare_enable(tdev->clk_ref); + if (ret) + goto err_clk_ref; ret = clk_prepare_enable(tdev->clk_pwr); if (ret) goto err_clk_pwr; @@ -70,8 +68,7 @@ nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev) err_clamp: clk_disable_unprepare(tdev->clk_pwr); err_clk_pwr: - if (tdev->clk_ref) - clk_disable_unprepare(tdev->clk_ref); + clk_disable_unprepare(tdev->clk_ref); err_clk_ref: clk_disable_unprepare(tdev->clk); err_clk: @@ -87,8 +84,7 @@ nvkm_device_tegra_power_down(struct nvkm_device_tegra *tdev) int ret; clk_disable_unprepare(tdev->clk_pwr); - if (tdev->clk_ref) - clk_disable_unprepare(tdev->clk_ref); + clk_disable_unprepare(tdev->clk_ref); clk_disable_unprepare(tdev->clk); udelay(10); -- 2.20.1
Lyude Paul
2022-May-23 20:11 UTC
[Nouveau] [PATCH] drm/nouveau/tegra: remove needless NULL check
Reviewed-by: Lyude Paul <lyude at redhat.com> Will push to the appropriate branch in a moment On Thu, 2022-05-19 at 15:29 +0800, Guo Zhengkui wrote:> There has already been NULL check in clk_prepare_enable() and > clk_disable_unprepare(), so remove needless NULL check before > calling them. > > Signed-off-by: Guo Zhengkui <guozhengkui at vivo.com> > --- > ?drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 14 +++++--------- > ?1 file changed, 5 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c > b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c > index 2ed528c065fa..ac9e122586bc 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c > +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c > @@ -41,11 +41,9 @@ nvkm_device_tegra_power_up(struct nvkm_device_tegra > *tdev) > ????????ret = clk_prepare_enable(tdev->clk); > ????????if (ret) > ????????????????goto err_clk; > -???????if (tdev->clk_ref) { > -???????????????ret = clk_prepare_enable(tdev->clk_ref); > -???????????????if (ret) > -???????????????????????goto err_clk_ref; > -???????} > +???????ret = clk_prepare_enable(tdev->clk_ref); > +???????if (ret) > +???????????????goto err_clk_ref; > ????????ret = clk_prepare_enable(tdev->clk_pwr); > ????????if (ret) > ????????????????goto err_clk_pwr; > @@ -70,8 +68,7 @@ nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev) > ?err_clamp: > ????????clk_disable_unprepare(tdev->clk_pwr); > ?err_clk_pwr: > -???????if (tdev->clk_ref) > -???????????????clk_disable_unprepare(tdev->clk_ref); > +???????clk_disable_unprepare(tdev->clk_ref); > ?err_clk_ref: > ????????clk_disable_unprepare(tdev->clk); > ?err_clk: > @@ -87,8 +84,7 @@ nvkm_device_tegra_power_down(struct nvkm_device_tegra > *tdev) > ????????int ret; > ? > ????????clk_disable_unprepare(tdev->clk_pwr); > -???????if (tdev->clk_ref) > -???????????????clk_disable_unprepare(tdev->clk_ref); > +???????clk_disable_unprepare(tdev->clk_ref); > ????????clk_disable_unprepare(tdev->clk); > ????????udelay(10); > ?-- Cheers, Lyude Paul (she/her) Software Engineer at Red Hat