diff options
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r-- | drivers/gpio/gpiolib.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 0495bf1d480a..bca3e7740ef6 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1379,7 +1379,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, | |||
1379 | 1379 | ||
1380 | status = gpiochip_add_irqchip(chip, lock_key, request_key); | 1380 | status = gpiochip_add_irqchip(chip, lock_key, request_key); |
1381 | if (status) | 1381 | if (status) |
1382 | goto err_remove_chip; | 1382 | goto err_free_gpiochip_mask; |
1383 | 1383 | ||
1384 | status = of_gpiochip_add(chip); | 1384 | status = of_gpiochip_add(chip); |
1385 | if (status) | 1385 | if (status) |
@@ -1387,7 +1387,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, | |||
1387 | 1387 | ||
1388 | status = gpiochip_init_valid_mask(chip); | 1388 | status = gpiochip_init_valid_mask(chip); |
1389 | if (status) | 1389 | if (status) |
1390 | goto err_remove_chip; | 1390 | goto err_remove_of_chip; |
1391 | 1391 | ||
1392 | for (i = 0; i < chip->ngpio; i++) { | 1392 | for (i = 0; i < chip->ngpio; i++) { |
1393 | struct gpio_desc *desc = &gdev->descs[i]; | 1393 | struct gpio_desc *desc = &gdev->descs[i]; |
@@ -1415,14 +1415,18 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, | |||
1415 | if (gpiolib_initialized) { | 1415 | if (gpiolib_initialized) { |
1416 | status = gpiochip_setup_dev(gdev); | 1416 | status = gpiochip_setup_dev(gdev); |
1417 | if (status) | 1417 | if (status) |
1418 | goto err_remove_chip; | 1418 | goto err_remove_acpi_chip; |
1419 | } | 1419 | } |
1420 | return 0; | 1420 | return 0; |
1421 | 1421 | ||
1422 | err_remove_chip: | 1422 | err_remove_acpi_chip: |
1423 | acpi_gpiochip_remove(chip); | 1423 | acpi_gpiochip_remove(chip); |
1424 | err_remove_of_chip: | ||
1424 | gpiochip_free_hogs(chip); | 1425 | gpiochip_free_hogs(chip); |
1425 | of_gpiochip_remove(chip); | 1426 | of_gpiochip_remove(chip); |
1427 | err_remove_chip: | ||
1428 | gpiochip_irqchip_remove(chip); | ||
1429 | err_free_gpiochip_mask: | ||
1426 | gpiochip_free_valid_mask(chip); | 1430 | gpiochip_free_valid_mask(chip); |
1427 | err_remove_irqchip_mask: | 1431 | err_remove_irqchip_mask: |
1428 | gpiochip_irqchip_free_valid_mask(chip); | 1432 | gpiochip_irqchip_free_valid_mask(chip); |