diff options
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-mockup.c | 6 | ||||
-rw-r--r-- | drivers/gpio/gpio-pxa.c | 4 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 5 |
3 files changed, 8 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c index 8269cffc2967..6a50f9f59c90 100644 --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c | |||
@@ -35,8 +35,8 @@ | |||
35 | #define gpio_mockup_err(...) pr_err(GPIO_MOCKUP_NAME ": " __VA_ARGS__) | 35 | #define gpio_mockup_err(...) pr_err(GPIO_MOCKUP_NAME ": " __VA_ARGS__) |
36 | 36 | ||
37 | enum { | 37 | enum { |
38 | GPIO_MOCKUP_DIR_OUT = 0, | 38 | GPIO_MOCKUP_DIR_IN = 0, |
39 | GPIO_MOCKUP_DIR_IN = 1, | 39 | GPIO_MOCKUP_DIR_OUT = 1, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | /* | 42 | /* |
@@ -131,7 +131,7 @@ static int gpio_mockup_get_direction(struct gpio_chip *gc, unsigned int offset) | |||
131 | { | 131 | { |
132 | struct gpio_mockup_chip *chip = gpiochip_get_data(gc); | 132 | struct gpio_mockup_chip *chip = gpiochip_get_data(gc); |
133 | 133 | ||
134 | return chip->lines[offset].dir; | 134 | return !chip->lines[offset].dir; |
135 | } | 135 | } |
136 | 136 | ||
137 | static int gpio_mockup_to_irq(struct gpio_chip *gc, unsigned int offset) | 137 | static int gpio_mockup_to_irq(struct gpio_chip *gc, unsigned int offset) |
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index bfe4c5c9f41c..e9600b556f39 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c | |||
@@ -268,8 +268,8 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
268 | 268 | ||
269 | if (pxa_gpio_has_pinctrl()) { | 269 | if (pxa_gpio_has_pinctrl()) { |
270 | ret = pinctrl_gpio_direction_input(chip->base + offset); | 270 | ret = pinctrl_gpio_direction_input(chip->base + offset); |
271 | if (!ret) | 271 | if (ret) |
272 | return 0; | 272 | return ret; |
273 | } | 273 | } |
274 | 274 | ||
275 | spin_lock_irqsave(&gpio_lock, flags); | 275 | spin_lock_irqsave(&gpio_lock, flags); |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 230e41562462..a2cbb474901c 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1295,7 +1295,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, | |||
1295 | gdev->descs = kcalloc(chip->ngpio, sizeof(gdev->descs[0]), GFP_KERNEL); | 1295 | gdev->descs = kcalloc(chip->ngpio, sizeof(gdev->descs[0]), GFP_KERNEL); |
1296 | if (!gdev->descs) { | 1296 | if (!gdev->descs) { |
1297 | status = -ENOMEM; | 1297 | status = -ENOMEM; |
1298 | goto err_free_gdev; | 1298 | goto err_free_ida; |
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | if (chip->ngpio == 0) { | 1301 | if (chip->ngpio == 0) { |
@@ -1427,8 +1427,9 @@ err_free_label: | |||
1427 | kfree_const(gdev->label); | 1427 | kfree_const(gdev->label); |
1428 | err_free_descs: | 1428 | err_free_descs: |
1429 | kfree(gdev->descs); | 1429 | kfree(gdev->descs); |
1430 | err_free_gdev: | 1430 | err_free_ida: |
1431 | ida_simple_remove(&gpio_ida, gdev->id); | 1431 | ida_simple_remove(&gpio_ida, gdev->id); |
1432 | err_free_gdev: | ||
1432 | /* failures here can mean systems won't boot... */ | 1433 | /* failures here can mean systems won't boot... */ |
1433 | pr_err("%s: GPIOs %d..%d (%s) failed to register, %d\n", __func__, | 1434 | pr_err("%s: GPIOs %d..%d (%s) failed to register, %d\n", __func__, |
1434 | gdev->base, gdev->base + gdev->ngpio - 1, | 1435 | gdev->base, gdev->base + gdev->ngpio - 1, |