Skip to contentSkip to conversation

clk: ingenic/TCU: Remove NULL pointer check before clk_enable/disable

PATCH In review Xu Wang 2 participants 2 messages Nov 4, 2020

Subsystems (2)
lore
Share & tools
lore

Xu Wang

author
#0 lore raw

PATCH 1/1 clk: ingenic/TCU: Remove NULL pointer check before clk_enable/disable

Because clk_enable and clk_disable already checked NULL clock parameter, so the additional checks are unnecessary, just remove them.

---
 drivers/clk/ingenic/tcu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/clk/ingenic/tcu.c +2 -4
index 9382dc3aa27e..ffcb3667fd2b 100644
@@ -445,8 +445,7 @@ static int __maybe_unused tcu_pm_suspend(void)
 {
 	struct ingenic_tcu *tcu = ingenic_tcu;
 
-	if (tcu->clk)
-		clk_disable(tcu->clk);
+	clk_disable(tcu->clk);
 
 	return 0;
 }
@@ -455,8 +454,7 @@ static void __maybe_unused tcu_pm_resume(void)
 {
 	struct ingenic_tcu *tcu = ingenic_tcu;
 
-	if (tcu->clk)
-		clk_enable(tcu->clk);
+	clk_enable(tcu->clk);
 }
 
 static struct syscore_ops __maybe_unused tcu_pm_ops = {
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 4 lines · Xu Wang

Because clk_enable and clk_disable already checked NULL clock parameter, so the additional checks are unnecessary, just remove them.

Cheers,
-Paul

Quoted 31 lines
---
 drivers/clk/ingenic/tcu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/clk/ingenic/tcu.c +2 -5
index 9382dc3aa27e..ffcb3667fd2b 100644
@@ -445,8 +445,7 @@ static int __maybe_unused tcu_pm_suspend(void)
 {
 	struct ingenic_tcu *tcu = ingenic_tcu;
 
-	if (tcu->clk)
-		clk_disable(tcu->clk);
+	clk_disable(tcu->clk);
 
 	return 0;
 }
@@ -455,8 +454,7 @@ static void __maybe_unused tcu_pm_resume(void)
 {
 	struct ingenic_tcu *tcu = ingenic_tcu;
 
-	if (tcu->clk)
-		clk_enable(tcu->clk);
+	clk_enable(tcu->clk);
 }
 
 static struct syscore_ops __maybe_unused tcu_pm_ops = {
--

2.17.1