Commit 8f91ed47 authored by Laxman Dewangan's avatar Laxman Dewangan Committed by Linus Walleij

pinctrl: digicolor: 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>
Cc: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 5c67425a
...@@ -280,7 +280,7 @@ static int dc_pinctrl_probe(struct platform_device *pdev) ...@@ -280,7 +280,7 @@ static int dc_pinctrl_probe(struct platform_device *pdev)
struct pinctrl_desc *pctl_desc; struct pinctrl_desc *pctl_desc;
char *pin_names; char *pin_names;
int name_len = strlen("GP_xx") + 1; int name_len = strlen("GP_xx") + 1;
int i, j, ret; int i, j;
pmap = devm_kzalloc(&pdev->dev, sizeof(*pmap), GFP_KERNEL); pmap = devm_kzalloc(&pdev->dev, sizeof(*pmap), GFP_KERNEL);
if (!pmap) if (!pmap)
...@@ -326,26 +326,19 @@ static int dc_pinctrl_probe(struct platform_device *pdev) ...@@ -326,26 +326,19 @@ static int dc_pinctrl_probe(struct platform_device *pdev)
pmap->dev = &pdev->dev; pmap->dev = &pdev->dev;
pmap->pctl = pinctrl_register(pctl_desc, &pdev->dev, pmap); pmap->pctl = devm_pinctrl_register(&pdev->dev, pctl_desc, pmap);
if (IS_ERR(pmap->pctl)) { if (IS_ERR(pmap->pctl)) {
dev_err(&pdev->dev, "pinctrl driver registration failed\n"); dev_err(&pdev->dev, "pinctrl driver registration failed\n");
return PTR_ERR(pmap->pctl); return PTR_ERR(pmap->pctl);
} }
ret = dc_gpiochip_add(pmap, pdev->dev.of_node); return dc_gpiochip_add(pmap, pdev->dev.of_node);
if (ret < 0) {
pinctrl_unregister(pmap->pctl);
return ret;
}
return 0;
} }
static int dc_pinctrl_remove(struct platform_device *pdev) static int dc_pinctrl_remove(struct platform_device *pdev)
{ {
struct dc_pinmap *pmap = platform_get_drvdata(pdev); struct dc_pinmap *pmap = platform_get_drvdata(pdev);
pinctrl_unregister(pmap->pctl);
gpiochip_remove(&pmap->chip); gpiochip_remove(&pmap->chip);
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