summaryrefslogtreecommitdiff
path: root/drivers/leds
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2020-06-13 09:15:06 +0200
committerPavel Machek <pavel@ucw.cz>2020-07-12 10:06:38 +0200
commit5ad79c20b6d28467db643ac107bbdaa01aa93a23 (patch)
tree0414f048784a7fedb9f77876894e14ffa218777c /drivers/leds
parent14d3e74f59a4d7f9bc2768376818d7bebb9ad27f (diff)
leds: trigger: gpio: Avoid warning on update of inverted
If the GPIO has not been configured yet, writing to inverted will raise a kernel warning. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/trigger/ledtrig-gpio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/leds/trigger/ledtrig-gpio.c b/drivers/leds/trigger/ledtrig-gpio.c
index dc64679b1a92..0120faa3dafa 100644
--- a/drivers/leds/trigger/ledtrig-gpio.c
+++ b/drivers/leds/trigger/ledtrig-gpio.c
@@ -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;
}