From 323de9efdf3e75d1dfb48003a52e59d6d9d4c7a5 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 9 Jun 2015 13:01:16 +0900 Subject: pinctrl: make pinctrl_register() return proper error code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, pinctrl_register() just returns NULL on error, so the callers can not know the exact reason of the failure. Some of the pinctrl drivers return -EINVAL, some -ENODEV, and some -ENOMEM on error of pinctrl_register(), although the error code might be different from the real cause of the error. This commit reworks pinctrl_register() to return the appropriate error code and modifies all of the pinctrl drivers to use IS_ERR() for the error checking and PTR_ERR() for getting the error code. Signed-off-by: Masahiro Yamada Acked-by: Patrice Chotard Acked-by: Thierry Reding Acked-by: Heiko Stuebner Tested-by: Mika Westerberg Acked-by: Mika Westerberg Acked-by: Lee Jones Acked-by: Sören Brinkmann Acked-by: Laurent Pinchart Acked-by: Ray Jui Acked-by: Antoine Tenart Acked-by: Hongzhou Yang Acked-by: Wei Chen Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-tz1090-pdc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/pinctrl/pinctrl-tz1090-pdc.c') diff --git a/drivers/pinctrl/pinctrl-tz1090-pdc.c b/drivers/pinctrl/pinctrl-tz1090-pdc.c index 8a8911bb883a..c349911708ef 100644 --- a/drivers/pinctrl/pinctrl-tz1090-pdc.c +++ b/drivers/pinctrl/pinctrl-tz1090-pdc.c @@ -948,9 +948,9 @@ static int tz1090_pdc_pinctrl_probe(struct platform_device *pdev) return PTR_ERR(pmx->regs); pmx->pctl = pinctrl_register(&tz1090_pdc_pinctrl_desc, &pdev->dev, pmx); - if (!pmx->pctl) { + if (IS_ERR(pmx->pctl)) { dev_err(&pdev->dev, "Couldn't register pinctrl driver\n"); - return -ENODEV; + return PTR_ERR(pmx->pctl); } platform_set_drvdata(pdev, pmx); -- cgit v1.2.1