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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
mutex_init(&state->mutex);
state->base = devm_ioremap_resource(dev, mem);
- if (!state->base) {
- dev_err(dev, "Request register region failed.\n");
- ret = -EBUSY;
+ if (IS_ERR(state->base)) {
+ ret = PTR_ERR(state->base);
goto fail;
}
}
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");
- ret = PTR_ERR(state->pctl);
+ ret = -EINVAL;
goto fail;
}