The patch titled drivers/leds/ledtrig-gpio.c: make output match input, tighten input checking has been added to the -mm tree. Its filename is drivers-leds-ledtrig-gpioc-make-output-match-input-tighten-input-checking.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: drivers/leds/ledtrig-gpio.c: make output match input, tighten input checking From: Janusz Krzysztofik <jkrzyszt@xxxxxxxxxxxx> Replicate changes made to drivers/leds/ledtrig-backlight.c. Cc: Paul Mundt <lethal@xxxxxxxxxxxx> Cc: Richard Purdie <richard.purdie@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/leds/ledtrig-gpio.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff -puN drivers/leds/ledtrig-gpio.c~drivers-leds-ledtrig-gpioc-make-output-match-input-tighten-input-checking drivers/leds/ledtrig-gpio.c --- a/drivers/leds/ledtrig-gpio.c~drivers-leds-ledtrig-gpioc-make-output-match-input-tighten-input-checking +++ a/drivers/leds/ledtrig-gpio.c @@ -99,7 +99,7 @@ static ssize_t gpio_trig_inverted_show(s struct led_classdev *led = dev_get_drvdata(dev); struct gpio_trig_data *gpio_data = led->trigger_data; - return sprintf(buf, "%s\n", gpio_data->inverted ? "yes" : "no"); + return sprintf(buf, "%u\n", gpio_data->inverted); } static ssize_t gpio_trig_inverted_store(struct device *dev, @@ -107,16 +107,17 @@ static ssize_t gpio_trig_inverted_store( { struct led_classdev *led = dev_get_drvdata(dev); struct gpio_trig_data *gpio_data = led->trigger_data; - unsigned inverted; + unsigned long inverted; int ret; - ret = sscanf(buf, "%u", &inverted); - if (ret < 1) { - dev_err(dev, "invalid value\n"); + ret = strict_strtoul(buf, 10, &inverted); + if (ret < 0) + return ret; + + if (inverted > 1) return -EINVAL; - } - gpio_data->inverted = !!inverted; + gpio_data->inverted = inverted; /* After inverting, we need to update the LED. */ schedule_work(&gpio_data->work); _ Patches currently in -mm which might be from jkrzyszt@xxxxxxxxxxxx are drivers-leds-ledtrig-gpioc-make-output-match-input-tighten-input-checking.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html