]> Pileus Git - ~andy/linux/commitdiff
pinctrl: tb10x: fix the error handling in tb10x_pinctrl_probe()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Mon, 21 Oct 2013 02:55:29 +0000 (10:55 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 23 Oct 2013 08:41:22 +0000 (10:41 +0200)
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>
drivers/pinctrl/pinctrl-tb10x.c

index 2e1ea568c9a274bc38ae130cbaad7813adea126e..9f7fa9b6ea8010e2b898ef9df21a9fdaa5dc05b7 100644 (file)
@@ -806,9 +806,8 @@ static int tb10x_pinctrl_probe(struct platform_device *pdev)
        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;
        }
 
@@ -830,9 +829,9 @@ static int tb10x_pinctrl_probe(struct platform_device *pdev)
        }
 
        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;
        }