Commit 86467ff2 authored by Wei Yongjun's avatar Wei Yongjun Committed by Linus Walleij

pinctrl: tb10x: fix the error handling in tb10x_pinctrl_probe()

This patch fix the error handling in tb10x_pinctrl_probe():
 - devm_ioremap_resource() return ERR_PTR() and never return NULL
 - remove the dev_err call to avoid redundant error message
 - pinctrl_register() returns NULL not ERR_PTR()
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent fe61052a
...@@ -806,9 +806,8 @@ static int tb10x_pinctrl_probe(struct platform_device *pdev) ...@@ -806,9 +806,8 @@ static int tb10x_pinctrl_probe(struct platform_device *pdev)
mutex_init(&state->mutex); mutex_init(&state->mutex);
state->base = devm_ioremap_resource(dev, mem); state->base = devm_ioremap_resource(dev, mem);
if (!state->base) { if (IS_ERR(state->base)) {
dev_err(dev, "Request register region failed.\n"); ret = PTR_ERR(state->base);
ret = -EBUSY;
goto fail; goto fail;
} }
...@@ -830,9 +829,9 @@ static int tb10x_pinctrl_probe(struct platform_device *pdev) ...@@ -830,9 +829,9 @@ static int tb10x_pinctrl_probe(struct platform_device *pdev)
} }
state->pctl = pinctrl_register(&tb10x_pindesc, dev, state); state->pctl = pinctrl_register(&tb10x_pindesc, dev, state);
if (IS_ERR(state->pctl)) { if (!state->pctl) {
dev_err(dev, "could not register TB10x pin driver\n"); dev_err(dev, "could not register TB10x pin driver\n");
ret = PTR_ERR(state->pctl); ret = -EINVAL;
goto fail; goto fail;
} }
......
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