if (ret)
goto err_cleanup_gdev_srcu;
- ret = of_gpiochip_add(gc);
- if (ret)
- goto err_free_gpiochip_mask;
-
for (i = 0; i < gc->ngpio; i++) {
struct gpio_desc *desc = &gdev->descs[i];
if (ret) {
for (j = 0; j < i; j++)
cleanup_srcu_struct(&gdev->descs[j].srcu);
- goto err_remove_of_chip;
+ goto err_free_gpiochip_mask;
}
if (gc->get_direction && gpiochip_line_is_valid(gc, i)) {
}
}
- ret = gpiochip_add_pin_ranges(gc);
+ ret = of_gpiochip_add(gc);
if (ret)
goto err_cleanup_desc_srcu;
+ ret = gpiochip_add_pin_ranges(gc);
+ if (ret)
+ goto err_remove_of_chip;
+
acpi_gpiochip_add(gc);
machine_gpiochip_add(gc);
gpiochip_irqchip_free_valid_mask(gc);
err_remove_acpi_chip:
acpi_gpiochip_remove(gc);
-err_cleanup_desc_srcu:
- for (i = 0; i < gdev->ngpio; i++)
- cleanup_srcu_struct(&gdev->descs[i].srcu);
err_remove_of_chip:
gpiochip_free_hogs(gc);
of_gpiochip_remove(gc);
+err_cleanup_desc_srcu:
+ for (i = 0; i < gdev->ngpio; i++)
+ cleanup_srcu_struct(&gdev->descs[i].srcu);
err_free_gpiochip_mask:
gpiochip_remove_pin_ranges(gc);
gpiochip_free_valid_mask(gc);