Commit 97fc4637 authored by Axel Lin's avatar Axel Lin Committed by Linus Walleij

pinctrl: Don't override the error code in probe error handling

Otherwise, we return 0 in probe error paths when gpiochip_remove() returns 0.
Also show error message if gpiochip_remove() fails.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avatarTony Prisk <linux@prisktech.co.nz>
Acked-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent b134dc3f
...@@ -830,7 +830,8 @@ static int __init u300_gpio_probe(struct platform_device *pdev) ...@@ -830,7 +830,8 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
return 0; return 0;
err_no_range: err_no_range:
err = gpiochip_remove(&gpio->chip); if (gpiochip_remove(&gpio->chip))
dev_err(&pdev->dev, "failed to remove gpio chip\n");
err_no_chip: err_no_chip:
err_no_domain: err_no_domain:
err_no_port: err_no_port:
......
...@@ -2000,7 +2000,8 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) ...@@ -2000,7 +2000,8 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
return 0; return 0;
gpiochip_error: gpiochip_error:
ret = gpiochip_remove(pctl->chip); if (gpiochip_remove(pctl->chip))
dev_err(&pdev->dev, "failed to remove gpio chip\n");
pinctrl_error: pinctrl_error:
pinctrl_unregister(pctl->pctl_dev); pinctrl_unregister(pctl->pctl_dev);
return ret; return ret;
......
...@@ -609,8 +609,7 @@ int wmt_pinctrl_probe(struct platform_device *pdev, ...@@ -609,8 +609,7 @@ int wmt_pinctrl_probe(struct platform_device *pdev,
return 0; return 0;
fail_range: fail_range:
err = gpiochip_remove(&data->gpio_chip); if (gpiochip_remove(&data->gpio_chip))
if (err)
dev_err(&pdev->dev, "failed to remove gpio chip\n"); dev_err(&pdev->dev, "failed to remove gpio chip\n");
fail_gpio: fail_gpio:
pinctrl_unregister(data->pctl_dev); pinctrl_unregister(data->pctl_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment