Commit ce18e595 authored by Laxman Dewangan's avatar Laxman Dewangan Committed by Linus Walleij

pinctrl: spmi: Use devm_pinctrl_register() for pinctrl registration

Use devm_pinctrl_register() for pin control registration and clean
the error path.
Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Jonas Gorski <jogo@openwrt.org>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent b46ddfe6
...@@ -877,14 +877,14 @@ static int pmic_mpp_probe(struct platform_device *pdev) ...@@ -877,14 +877,14 @@ static int pmic_mpp_probe(struct platform_device *pdev)
state->chip.of_gpio_n_cells = 2; state->chip.of_gpio_n_cells = 2;
state->chip.can_sleep = false; state->chip.can_sleep = false;
state->ctrl = pinctrl_register(pctrldesc, dev, state); state->ctrl = devm_pinctrl_register(dev, pctrldesc, state);
if (IS_ERR(state->ctrl)) if (IS_ERR(state->ctrl))
return PTR_ERR(state->ctrl); return PTR_ERR(state->ctrl);
ret = gpiochip_add_data(&state->chip, state); ret = gpiochip_add_data(&state->chip, state);
if (ret) { if (ret) {
dev_err(state->dev, "can't add gpio chip\n"); dev_err(state->dev, "can't add gpio chip\n");
goto err_chip; return ret;
} }
ret = gpiochip_add_pin_range(&state->chip, dev_name(dev), 0, 0, npins); ret = gpiochip_add_pin_range(&state->chip, dev_name(dev), 0, 0, npins);
...@@ -897,8 +897,6 @@ static int pmic_mpp_probe(struct platform_device *pdev) ...@@ -897,8 +897,6 @@ static int pmic_mpp_probe(struct platform_device *pdev)
err_range: err_range:
gpiochip_remove(&state->chip); gpiochip_remove(&state->chip);
err_chip:
pinctrl_unregister(state->ctrl);
return ret; return ret;
} }
...@@ -907,7 +905,6 @@ static int pmic_mpp_remove(struct platform_device *pdev) ...@@ -907,7 +905,6 @@ static int pmic_mpp_remove(struct platform_device *pdev)
struct pmic_mpp_state *state = platform_get_drvdata(pdev); struct pmic_mpp_state *state = platform_get_drvdata(pdev);
gpiochip_remove(&state->chip); gpiochip_remove(&state->chip);
pinctrl_unregister(state->ctrl);
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