Commit a956fe4a authored by Laxman Dewangan's avatar Laxman Dewangan Committed by Khalid Elmously

pinctrl: amd: Use devm_pinctrl_register() for pinctrl registration

Use devm_pinctrl_register() for pin control registration and clean
error path.
Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>

CVE-2017-18174

(cherry picked from commit 251e22ab)
Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
Acked-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 699a2f5c
...@@ -782,8 +782,8 @@ static int amd_gpio_probe(struct platform_device *pdev) ...@@ -782,8 +782,8 @@ static int amd_gpio_probe(struct platform_device *pdev)
gpio_dev->ngroups = ARRAY_SIZE(kerncz_groups); gpio_dev->ngroups = ARRAY_SIZE(kerncz_groups);
amd_pinctrl_desc.name = dev_name(&pdev->dev); amd_pinctrl_desc.name = dev_name(&pdev->dev);
gpio_dev->pctrl = pinctrl_register(&amd_pinctrl_desc, gpio_dev->pctrl = devm_pinctrl_register(&pdev->dev, &amd_pinctrl_desc,
&pdev->dev, gpio_dev); gpio_dev);
if (IS_ERR(gpio_dev->pctrl)) { if (IS_ERR(gpio_dev->pctrl)) {
dev_err(&pdev->dev, "Couldn't register pinctrl driver\n"); dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
return PTR_ERR(gpio_dev->pctrl); return PTR_ERR(gpio_dev->pctrl);
...@@ -791,7 +791,7 @@ static int amd_gpio_probe(struct platform_device *pdev) ...@@ -791,7 +791,7 @@ static int amd_gpio_probe(struct platform_device *pdev)
ret = gpiochip_add(&gpio_dev->gc); ret = gpiochip_add(&gpio_dev->gc);
if (ret) if (ret)
goto out1; return ret;
ret = gpiochip_add_pin_range(&gpio_dev->gc, dev_name(&pdev->dev), ret = gpiochip_add_pin_range(&gpio_dev->gc, dev_name(&pdev->dev),
0, 0, TOTAL_NUMBER_OF_PINS); 0, 0, TOTAL_NUMBER_OF_PINS);
...@@ -824,8 +824,6 @@ static int amd_gpio_probe(struct platform_device *pdev) ...@@ -824,8 +824,6 @@ static int amd_gpio_probe(struct platform_device *pdev)
out2: out2:
gpiochip_remove(&gpio_dev->gc); gpiochip_remove(&gpio_dev->gc);
out1:
pinctrl_unregister(gpio_dev->pctrl);
return ret; return ret;
} }
...@@ -836,7 +834,6 @@ static int amd_gpio_remove(struct platform_device *pdev) ...@@ -836,7 +834,6 @@ static int amd_gpio_remove(struct platform_device *pdev)
gpio_dev = platform_get_drvdata(pdev); gpio_dev = platform_get_drvdata(pdev);
gpiochip_remove(&gpio_dev->gc); gpiochip_remove(&gpio_dev->gc);
pinctrl_unregister(gpio_dev->pctrl);
return 0; return 0;
} }
......
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