leds: lp8860: Remove duplicate NULL checks for gpio_desc
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 15 Feb 2023 17:04:03 +0000 (19:04 +0200)
committerLee Jones <lee@kernel.org>
Thu, 16 Mar 2023 15:08:40 +0000 (15:08 +0000)
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>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230215170403.84449-2-andriy.shevchenko@linux.intel.com
drivers/leds/leds-lp8860.c

index 666f4d38214fc89dc7fb40eaa77e761b8a22a810..221b386443bce9eed8bd9f1e5e9d049f5493bb09 100644 (file)
@@ -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);