Skip to content

Commit 6d19367

Browse files
andy-shevlag-linaro
authored andcommitted
leds: lp8860: Remove duplicate NULL checks for gpio_desc
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
1 parent 2956ad8 commit 6d19367

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

drivers/leds/leds-lp8860.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@ static int lp8860_init(struct lp8860_led *led)
249249
}
250250
}
251251

252-
if (led->enable_gpio)
253-
gpiod_direction_output(led->enable_gpio, 1);
252+
gpiod_direction_output(led->enable_gpio, 1);
254253

255254
ret = lp8860_fault_check(led);
256255
if (ret)
@@ -293,8 +292,7 @@ static int lp8860_init(struct lp8860_led *led)
293292

294293
out:
295294
if (ret)
296-
if (led->enable_gpio)
297-
gpiod_direction_output(led->enable_gpio, 0);
295+
gpiod_direction_output(led->enable_gpio, 0);
298296

299297
if (led->regulator) {
300298
ret = regulator_disable(led->regulator);
@@ -448,8 +446,7 @@ static void lp8860_remove(struct i2c_client *client)
448446
struct lp8860_led *led = i2c_get_clientdata(client);
449447
int ret;
450448

451-
if (led->enable_gpio)
452-
gpiod_direction_output(led->enable_gpio, 0);
449+
gpiod_direction_output(led->enable_gpio, 0);
453450

454451
if (led->regulator) {
455452
ret = regulator_disable(led->regulator);

0 commit comments

Comments
 (0)