pinctrl: vt8500: Use devm_pinctrl_register() for pinctrl registration
authorLaxman Dewangan <ldewangan@nvidia.com>
Wed, 24 Feb 2016 09:14:07 +0000 (14:44 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 21 Apr 2016 07:23:20 +0000 (09:23 +0200)
Use devm_pinctrl_register() for pin control registration and clean
the error path.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Hongzhou Yang <hongzhou.yang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/vt8500/pinctrl-wmt.c

index 5c261bf5542fb19b23156c57be6f642f2098ec73..cbc6386316783daabc445cb26d9d7d56d9673380 100644 (file)
@@ -583,7 +583,7 @@ int wmt_pinctrl_probe(struct platform_device *pdev,
 
        data->dev = &pdev->dev;
 
-       data->pctl_dev = pinctrl_register(&wmt_desc, &pdev->dev, data);
+       data->pctl_dev = devm_pinctrl_register(&pdev->dev, &wmt_desc, data);
        if (IS_ERR(data->pctl_dev)) {
                dev_err(&pdev->dev, "Failed to register pinctrl\n");
                return PTR_ERR(data->pctl_dev);
@@ -592,7 +592,7 @@ int wmt_pinctrl_probe(struct platform_device *pdev,
        err = gpiochip_add_data(&data->gpio_chip, data);
        if (err) {
                dev_err(&pdev->dev, "could not add GPIO chip\n");
-               goto fail_gpio;
+               return err;
        }
 
        err = gpiochip_add_pin_range(&data->gpio_chip, dev_name(data->dev),
@@ -606,8 +606,6 @@ int wmt_pinctrl_probe(struct platform_device *pdev,
 
 fail_range:
        gpiochip_remove(&data->gpio_chip);
-fail_gpio:
-       pinctrl_unregister(data->pctl_dev);
        return err;
 }
 
@@ -616,7 +614,6 @@ int wmt_pinctrl_remove(struct platform_device *pdev)
        struct wmt_pinctrl_data *data = platform_get_drvdata(pdev);
 
        gpiochip_remove(&data->gpio_chip);
-       pinctrl_unregister(data->pctl_dev);
 
        return 0;
 }