pinctrl: Don't override the error code in probe error handling
authorAxel Lin <axel.lin@ingics.com>
Sun, 19 May 2013 05:58:37 +0000 (13:58 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 27 May 2013 13:37:08 +0000 (15:37 +0200)
Otherwise, we return 0 in probe error paths when gpiochip_remove() returns 0.
Also show error message if gpiochip_remove() fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-coh901.c
drivers/pinctrl/pinctrl-sunxi.c
drivers/pinctrl/vt8500/pinctrl-wmt.c

index a67af419f5317b3ddd7ad4d777bcc49d30142dec..d6b41747d687e13c188340ed08a3027c9646245d 100644 (file)
@@ -830,7 +830,8 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
        return 0;
 
 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_domain:
 err_no_port:
index c52fc2c087327c6239c867bec7553a4eadd99d0c..c058529db8f645cfd4a7888e1f5c5e0175edda2f 100644 (file)
@@ -2000,7 +2000,8 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
        return 0;
 
 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_unregister(pctl->pctl_dev);
        return ret;
index ab63104e8dc98eb148378b859b6217c93170c304..70d986e04afb205d6b908fb95d25b87b0d0c6804 100644 (file)
@@ -609,8 +609,7 @@ int wmt_pinctrl_probe(struct platform_device *pdev,
        return 0;
 
 fail_range:
-       err = gpiochip_remove(&data->gpio_chip);
-       if (err)
+       if (gpiochip_remove(&data->gpio_chip))
                dev_err(&pdev->dev, "failed to remove gpio chip\n");
 fail_gpio:
        pinctrl_unregister(data->pctl_dev);