aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorMathias Nyman <mathias.nyman@linux.intel.com>2012-10-25 07:03:03 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-10-26 03:25:10 -0400
commitad2fab36d7922401c4576fb7ea9b21a47a29a17f (patch)
tree16b7246490039315f86bbd45e987a71367f94000 /drivers/gpio/gpiolib.c
parentc57d75c099e55500b620f50a207e61b9e20ecd29 (diff)
gpiolib: Don't return -EPROBE_DEFER to sysfs, or for invalid gpios
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>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 5d6c71edc739..1c8d9e3380e1 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -623,9 +623,11 @@ static ssize_t export_store(struct class *class,
623 */ 623 */
624 624
625 status = gpio_request(gpio, "sysfs"); 625 status = gpio_request(gpio, "sysfs");
626 if (status < 0) 626 if (status < 0) {
627 if (status == -EPROBE_DEFER)
628 status = -ENODEV;
627 goto done; 629 goto done;
628 630 }
629 status = gpio_export(gpio, true); 631 status = gpio_export(gpio, true);
630 if (status < 0) 632 if (status < 0)
631 gpio_free(gpio); 633 gpio_free(gpio);
@@ -1191,8 +1193,10 @@ int gpio_request(unsigned gpio, const char *label)
1191 1193
1192 spin_lock_irqsave(&gpio_lock, flags); 1194 spin_lock_irqsave(&gpio_lock, flags);
1193 1195
1194 if (!gpio_is_valid(gpio)) 1196 if (!gpio_is_valid(gpio)) {
1197 status = -EINVAL;
1195 goto done; 1198 goto done;
1199 }
1196 desc = &gpio_desc[gpio]; 1200 desc = &gpio_desc[gpio];
1197 chip = desc->chip; 1201 chip = desc->chip;
1198 if (chip == NULL) 1202 if (chip == NULL)