[PATCH] pwm: sifive: simplify if-if to if-else

Wan Jiabing wanjiabing at vivo.com
Fri Apr 8 01:30:07 PDT 2022


use if and else instead of if(A) and if (!A).

Signed-off-by: Wan Jiabing <wanjiabing at vivo.com>
---
 drivers/pwm/pwm-sifive.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c
index 253c4a17d255..e6d05a329002 100644
--- a/drivers/pwm/pwm-sifive.c
+++ b/drivers/pwm/pwm-sifive.c
@@ -138,10 +138,9 @@ static int pwm_sifive_enable(struct pwm_chip *chip, bool enable)
 			dev_err(ddata->chip.dev, "Enable clk failed\n");
 			return ret;
 		}
-	}
-
-	if (!enable)
+	} else {
 		clk_disable(ddata->clk);
+	}
 
 	return 0;
 }
-- 
2.35.1




More information about the linux-riscv mailing list