aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/trigger/ledtrig-gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/leds/trigger/ledtrig-gpio.c')
-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;
}