Skip to content

Commit

Permalink
gpiolib: Don't return -EPROBE_DEFER to sysfs, or for invalid gpios
Browse files Browse the repository at this point in the history
gpios requested with invalid numbers, or gpios requested from userspace via sysfs
should not try to be deferred on failure.

Cc: stable@kernel.org
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Mathias Nyman authored and Linus Walleij committed Oct 26, 2012
1 parent c57d75c commit ad2fab3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,11 @@ static ssize_t export_store(struct class *class,
*/

status = gpio_request(gpio, "sysfs");
if (status < 0)
if (status < 0) {
if (status == -EPROBE_DEFER)
status = -ENODEV;
goto done;

}
status = gpio_export(gpio, true);
if (status < 0)
gpio_free(gpio);
Expand Down Expand Up @@ -1191,8 +1193,10 @@ int gpio_request(unsigned gpio, const char *label)

spin_lock_irqsave(&gpio_lock, flags);

if (!gpio_is_valid(gpio))
if (!gpio_is_valid(gpio)) {
status = -EINVAL;
goto done;
}
desc = &gpio_desc[gpio];
chip = desc->chip;
if (chip == NULL)
Expand Down

0 comments on commit ad2fab3

Please sign in to comment.