diff mbox series

i2c: mediatek: remove redundant null check

Message ID 20200930084233.53085-1-vulab@iscas.ac.cn
State Accepted
Commit 5b9df0acd22a0bcd4e0e97e6f8368c31843ceb95
Headers show
Series i2c: mediatek: remove redundant null check | expand

Commit Message

Xu Wang Sept. 30, 2020, 8:42 a.m. UTC
Because clk_disable_unprepare already checked NULL clock parameter,
so the additional checks are unnecessary, just remove it

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/i2c/busses/i2c-mt65xx.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Qii Wang (王琪) Oct. 26, 2020, 1:31 a.m. UTC | #1
Thanks, it looks good for me, it would be better to remove all useless
members

On Wed, 2020-09-30 at 08:42 +0000, Xu Wang wrote:
> Because clk_disable_unprepare already checked NULL clock parameter,

> so the additional checks are unnecessary, just remove it

> 

> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>

> ---

>  drivers/i2c/busses/i2c-mt65xx.c | 9 +++------

>  1 file changed, 3 insertions(+), 6 deletions(-)

> 

> diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c

> index 0cbdfbe605b5..48d37de827e1 100644

> --- a/drivers/i2c/busses/i2c-mt65xx.c

> +++ b/drivers/i2c/busses/i2c-mt65xx.c

> @@ -449,8 +449,7 @@ static int mtk_i2c_clock_enable(struct mtk_i2c *i2c)

>  	return 0;

>  

>  err_arb:

> -	if (i2c->have_pmic)

> -		clk_disable_unprepare(i2c->clk_pmic);

> +	clk_disable_unprepare(i2c->clk_pmic);

>  err_pmic:

>  	clk_disable_unprepare(i2c->clk_main);

>  err_main:

> @@ -461,11 +460,9 @@ static int mtk_i2c_clock_enable(struct mtk_i2c *i2c)

>  

>  static void mtk_i2c_clock_disable(struct mtk_i2c *i2c)

>  {

> -	if (i2c->clk_arb)

> -		clk_disable_unprepare(i2c->clk_arb);

> +	clk_disable_unprepare(i2c->clk_arb);

>  

> -	if (i2c->have_pmic)

> -		clk_disable_unprepare(i2c->clk_pmic);

> +	clk_disable_unprepare(i2c->clk_pmic);

>  

>  	clk_disable_unprepare(i2c->clk_main);

>  	clk_disable_unprepare(i2c->clk_dma);
Wolfram Sang March 1, 2022, 3:23 p.m. UTC | #2
On Wed, Sep 30, 2020 at 08:42:33AM +0000, Xu Wang wrote:
> Because clk_disable_unprepare already checked NULL clock parameter,
> so the additional checks are unnecessary, just remove it
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>

Missed Qii Wang's ack so far, sorry. Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index 0cbdfbe605b5..48d37de827e1 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -449,8 +449,7 @@  static int mtk_i2c_clock_enable(struct mtk_i2c *i2c)
 	return 0;
 
 err_arb:
-	if (i2c->have_pmic)
-		clk_disable_unprepare(i2c->clk_pmic);
+	clk_disable_unprepare(i2c->clk_pmic);
 err_pmic:
 	clk_disable_unprepare(i2c->clk_main);
 err_main:
@@ -461,11 +460,9 @@  static int mtk_i2c_clock_enable(struct mtk_i2c *i2c)
 
 static void mtk_i2c_clock_disable(struct mtk_i2c *i2c)
 {
-	if (i2c->clk_arb)
-		clk_disable_unprepare(i2c->clk_arb);
+	clk_disable_unprepare(i2c->clk_arb);
 
-	if (i2c->have_pmic)
-		clk_disable_unprepare(i2c->clk_pmic);
+	clk_disable_unprepare(i2c->clk_pmic);
 
 	clk_disable_unprepare(i2c->clk_main);
 	clk_disable_unprepare(i2c->clk_dma);