Message ID | d560d3eb-774d-8d9f-a8e3-09c371fc03eb@web.de |
---|---|
State | New |
Headers | show |
Series | leds: trigger: gpio: Avoid warning on update of inverted | expand |
On Sat 2020-06-13 09:15:06, Jan Kiszka wrote: > From: Jan Kiszka <jan.kiszka@siemens.com> > > 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> Thanks, applied. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
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; }