If the probe function fails the driver core cares to return the allocated resources automatically. So the driver can be simplified accordingly. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> --- drivers/pinctrl/pinctrl-rza1.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c index 717c0f4449a0..246b1fbb924d 100644 --- a/drivers/pinctrl/pinctrl-rza1.c +++ b/drivers/pinctrl/pinctrl-rza1.c @@ -1285,7 +1285,7 @@ static int rza1_gpio_register(struct rza1_pinctrl *rza1_pctl) ret = rza1_parse_gpiochip(rza1_pctl, child, &gpio_chips[i], &gpio_ranges[i]); if (ret) - goto gpiochip_remove; + return ret; ++i; } @@ -1293,12 +1293,6 @@ static int rza1_gpio_register(struct rza1_pinctrl *rza1_pctl) dev_info(rza1_pctl->dev, "Registered %u gpio controllers\n", i); return 0; - -gpiochip_remove: - for (; i > 0; i--) - devm_gpiochip_remove(rza1_pctl->dev, &gpio_chips[i - 1]); - - return ret; } /** -- 2.19.0