Skip to content

Commit

Permalink
leds: trigger: gpio: Avoid warning on update of inverted
Browse files Browse the repository at this point in the history
If the GPIO has not been configured yet, writing to inverted will raise
a kernel warning.

Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
  • Loading branch information
jan-kiszka authored and pavelmachek committed Jul 12, 2020
1 parent 14d3e74 commit 5ad79c2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/leds/trigger/ledtrig-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ static ssize_t gpio_trig_inverted_store(struct device *dev,
gpio_data->inverted = inverted;

/* After inverting, we need to update the LED. */
gpio_trig_irq(0, led);
if (gpio_is_valid(gpio_data->gpio))
gpio_trig_irq(0, led);

return n;
}
Expand Down

0 comments on commit 5ad79c2

Please sign in to comment.