leds: gpio: Fix semantic error

Message ID 20200703181338.602569-1-linus.walleij@linaro.org
State New
Headers show
Series
  • leds: gpio: Fix semantic error
Related show

Commit Message

Linus Walleij July 3, 2020, 6:13 p.m.
The leds-gpio driver mixes up the legacy GPIO flags with the
GPIO descriptor flags and passes a legacy flag to
devm_gpiod_get_index().

Fix this by replacing the flags variable with the strict
descriptor flag.

Fixes: 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/leds/leds-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.25.4

Comments

Pavel Machek July 12, 2020, 8:14 a.m. | #1
On Fri 2020-07-03 20:13:38, Linus Walleij wrote:
> The leds-gpio driver mixes up the legacy GPIO flags with the

> GPIO descriptor flags and passes a legacy flag to

> devm_gpiod_get_index().

> 

> Fix this by replacing the flags variable with the strict

> descriptor flag.

> 

> Fixes: 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


Thanks, applied.
								Pavel
								
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Patch

diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 2bf74595610f..200688c602cd 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -220,7 +220,7 @@  static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
 	 * device, this will hit the board file, if any and get
 	 * the GPIO from there.
 	 */
-	gpiod = devm_gpiod_get_index(dev, NULL, idx, flags);
+	gpiod = devm_gpiod_get_index(dev, NULL, idx, GPIOD_OUT_LOW);
 	if (!IS_ERR(gpiod)) {
 		gpiod_set_consumer_name(gpiod, template->name);
 		return gpiod;