diff mbox series

[v1,2/2] leds: lp8860: Remove duplicate NULL checks

Message ID 20230215170403.84449-2-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1,1/2] leds: lp8860: Remove unused of_gpio,h | expand

Commit Message

Andy Shevchenko Feb. 15, 2023, 5:04 p.m. UTC
gpiod_*() API check already for the NULL, no need
to repeat that in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/leds/leds-lp8860.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Lee Jones March 3, 2023, 10:30 a.m. UTC | #1
On Wed, 15 Feb 2023, Andy Shevchenko wrote:

> gpiod_*() API check already for the NULL, no need
> to repeat that in the driver.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/leds/leds-lp8860.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)

Applied, thanks
diff mbox series

Patch

diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c
index 666f4d38214f..221b386443bc 100644
--- a/drivers/leds/leds-lp8860.c
+++ b/drivers/leds/leds-lp8860.c
@@ -249,8 +249,7 @@  static int lp8860_init(struct lp8860_led *led)
 		}
 	}
 
-	if (led->enable_gpio)
-		gpiod_direction_output(led->enable_gpio, 1);
+	gpiod_direction_output(led->enable_gpio, 1);
 
 	ret = lp8860_fault_check(led);
 	if (ret)
@@ -293,8 +292,7 @@  static int lp8860_init(struct lp8860_led *led)
 
 out:
 	if (ret)
-		if (led->enable_gpio)
-			gpiod_direction_output(led->enable_gpio, 0);
+		gpiod_direction_output(led->enable_gpio, 0);
 
 	if (led->regulator) {
 		ret = regulator_disable(led->regulator);
@@ -448,8 +446,7 @@  static void lp8860_remove(struct i2c_client *client)
 	struct lp8860_led *led = i2c_get_clientdata(client);
 	int ret;
 
-	if (led->enable_gpio)
-		gpiod_direction_output(led->enable_gpio, 0);
+	gpiod_direction_output(led->enable_gpio, 0);
 
 	if (led->regulator) {
 		ret = regulator_disable(led->regulator);