diff options
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r-- | drivers/gpio/gpiolib.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 3ca36542e338..713ca0e37f23 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1101,14 +1101,20 @@ int gpiochip_add(struct gpio_chip *chip) | |||
1101 | 1101 | ||
1102 | unlock: | 1102 | unlock: |
1103 | spin_unlock_irqrestore(&gpio_lock, flags); | 1103 | spin_unlock_irqrestore(&gpio_lock, flags); |
1104 | if (status == 0) | 1104 | |
1105 | status = gpiochip_export(chip); | 1105 | if (status) |
1106 | goto fail; | ||
1107 | |||
1108 | status = gpiochip_export(chip); | ||
1109 | if (status) | ||
1110 | goto fail; | ||
1111 | |||
1112 | return 0; | ||
1106 | fail: | 1113 | fail: |
1107 | /* failures here can mean systems won't boot... */ | 1114 | /* failures here can mean systems won't boot... */ |
1108 | if (status) | 1115 | pr_err("gpiochip_add: gpios %d..%d (%s) failed to register\n", |
1109 | pr_err("gpiochip_add: gpios %d..%d (%s) failed to register\n", | 1116 | chip->base, chip->base + chip->ngpio - 1, |
1110 | chip->base, chip->base + chip->ngpio - 1, | 1117 | chip->label ? : "generic"); |
1111 | chip->label ? : "generic"); | ||
1112 | return status; | 1118 | return status; |
1113 | } | 1119 | } |
1114 | EXPORT_SYMBOL_GPL(gpiochip_add); | 1120 | EXPORT_SYMBOL_GPL(gpiochip_add); |