diff options
author | Mathias Nyman <mathias.nyman@linux.intel.com> | 2012-10-25 14:03:03 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-05 09:50:41 +0100 |
commit | e7355f1112773a015e914b4f815460b7bbe88954 (patch) | |
tree | 2201a951e3beddfeaf09a59f7c4c4127bb8086b8 /drivers | |
parent | 0659a3107481012c778d9e249a3561474a4b4a7d (diff) | |
download | linux-3.10-e7355f1112773a015e914b4f815460b7bbe88954.tar.gz linux-3.10-e7355f1112773a015e914b4f815460b7bbe88954.tar.bz2 linux-3.10-e7355f1112773a015e914b4f815460b7bbe88954.zip |
gpiolib: Don't return -EPROBE_DEFER to sysfs, or for invalid gpios
commit ad2fab36d7922401c4576fb7ea9b21a47a29a17f upstream.
gpios requested with invalid numbers, or gpios requested from userspace via sysfs
should not try to be deferred on failure.
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpio/gpiolib.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 5a75510d66b..112c16e0847 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -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); @@ -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) |