Skip to contentSkip to conversation

drm/msm: dsi: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare

PATCH In review Xu Wang 2 participants 2 messages Dec 31, 2020 – Oct 2, 2021

Subsystems (3)
lore
Share & tools
lore

Xu Wang

author
#0 lore raw

PATCH 1/1 drm/msm: dsi: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare

Because clk_prepare_enable() and clk_disable_unprepare() already checked NULL clock parameter, so the additional checks are unnecessary, just remove them.

---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +6 -9
index ab281cba0f08..e7af90f045bf 100644
@@ -565,13 +565,11 @@ int dsi_link_clk_enable_6g(struct msm_dsi_host *msm_host)
 		goto pixel_clk_err;
 	}
 
-	if (msm_host->byte_intf_clk) {
-		ret = clk_prepare_enable(msm_host->byte_intf_clk);
-		if (ret) {
-			pr_err("%s: Failed to enable byte intf clk\n",
-			       __func__);
-			goto byte_intf_clk_err;
-		}
+	ret = clk_prepare_enable(msm_host->byte_intf_clk);
+	if (ret) {
+		pr_err("%s: Failed to enable byte intf clk\n",
+			   __func__);
+		goto byte_intf_clk_err;
 	}
 
 	return 0;
@@ -667,8 +665,7 @@ void dsi_link_clk_disable_6g(struct msm_dsi_host *msm_host)
 	dev_pm_opp_set_rate(&msm_host->pdev->dev, 0);
 	clk_disable_unprepare(msm_host->esc_clk);
 	clk_disable_unprepare(msm_host->pixel_clk);
-	if (msm_host->byte_intf_clk)
-		clk_disable_unprepare(msm_host->byte_intf_clk);
+	clk_disable_unprepare(msm_host->byte_intf_clk);
 	clk_disable_unprepare(msm_host->byte_clk);
 }
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Xu Wang

Because clk_prepare_enable() and clk_disable_unprepare() already checked NULL clock parameter, so the additional checks are unnecessary, just remove them.

Quoted 38 lines
---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 15 ++++++---------
  1 file changed, 6 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +6 -9
index ab281cba0f08..e7af90f045bf 100644
@@ -565,13 +565,11 @@ int dsi_link_clk_enable_6g(struct msm_dsi_host *msm_host)
  		goto pixel_clk_err;
  	}
 
-	if (msm_host->byte_intf_clk) {
-		ret = clk_prepare_enable(msm_host->byte_intf_clk);
-		if (ret) {
-			pr_err("%s: Failed to enable byte intf clk\n",
-			       __func__);
-			goto byte_intf_clk_err;
-		}
+	ret = clk_prepare_enable(msm_host->byte_intf_clk);
+	if (ret) {
+		pr_err("%s: Failed to enable byte intf clk\n",
+			   __func__);
+		goto byte_intf_clk_err;
  	}
 
  	return 0;
@@ -667,8 +665,7 @@ void dsi_link_clk_disable_6g(struct msm_dsi_host *msm_host)
  	dev_pm_opp_set_rate(&msm_host->pdev->dev, 0);
  	clk_disable_unprepare(msm_host->esc_clk);
  	clk_disable_unprepare(msm_host->pixel_clk);
-	if (msm_host->byte_intf_clk)
-		clk_disable_unprepare(msm_host->byte_intf_clk);
+	clk_disable_unprepare(msm_host->byte_intf_clk);
  	clk_disable_unprepare(msm_host->byte_clk);
  }
 
Signature · 2 lines
With best wishes
Dmitry