pinctrl: as3722: 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:21 +0000 (09:23 +0200)
Use devm_pinctrl_register() for pin control registration and clean
error path.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-as3722.c

index 1070bb9fa99d060c9b28086b4ca8400cd1e9eaae..4e9fe7854e8abe6f0e9b50eb65a5c2f2c3994fd5 100644 (file)
@@ -569,8 +569,8 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
        as3722_pinctrl_desc.name = dev_name(&pdev->dev);
        as3722_pinctrl_desc.pins = as3722_pins_desc;
        as3722_pinctrl_desc.npins = ARRAY_SIZE(as3722_pins_desc);
-       as_pci->pctl = pinctrl_register(&as3722_pinctrl_desc,
-                                       &pdev->dev, as_pci);
+       as_pci->pctl = devm_pinctrl_register(&pdev->dev, &as3722_pinctrl_desc,
+                                            as_pci);
        if (IS_ERR(as_pci->pctl)) {
                dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
                return PTR_ERR(as_pci->pctl);
@@ -582,7 +582,7 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
        ret = gpiochip_add_data(&as_pci->gpio_chip, as_pci);
        if (ret < 0) {
                dev_err(&pdev->dev, "Couldn't register gpiochip, %d\n", ret);
-               goto fail_chip_add;
+               return ret;
        }
 
        ret = gpiochip_add_pin_range(&as_pci->gpio_chip, dev_name(&pdev->dev),
@@ -596,8 +596,6 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
 
 fail_range_add:
        gpiochip_remove(&as_pci->gpio_chip);
-fail_chip_add:
-       pinctrl_unregister(as_pci->pctl);
        return ret;
 }
 
@@ -606,7 +604,6 @@ static int as3722_pinctrl_remove(struct platform_device *pdev)
        struct as3722_pctrl_info *as_pci = platform_get_drvdata(pdev);
 
        gpiochip_remove(&as_pci->gpio_chip);
-       pinctrl_unregister(as_pci->pctl);
        return 0;
 }