diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2015-06-09 04:01:16 (GMT) |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-06-10 12:49:52 (GMT) |
commit | 323de9efdf3e75d1dfb48003a52e59d6d9d4c7a5 (patch) | |
tree | 2dbda67827f15a22bfd1b2cc209307264f0c69a3 /drivers/pinctrl/bcm | |
parent | e73ac02dc132dcef1add62a1fac3e77a7ce17371 (diff) | |
download | linux-323de9efdf3e75d1dfb48003a52e59d6d9d4c7a5.tar.xz |
pinctrl: make pinctrl_register() return proper error code
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 <yamada.masahiro@socionext.com>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Lee Jones <lee@kernel.org>
Acked-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Ray Jui <rjui@broadcom.com>
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com>
Acked-by: Wei Chen <Wei.Chen@csr.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/bcm')
-rw-r--r-- | drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 4 | ||||
-rw-r--r-- | drivers/pinctrl/bcm/pinctrl-bcm2835.c | 4 | ||||
-rw-r--r-- | drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c | 4 | ||||
-rw-r--r-- | drivers/pinctrl/bcm/pinctrl-cygnus-mux.c | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c index 9641f1c..c3c692e 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c @@ -1425,9 +1425,9 @@ static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev) pctl = pinctrl_register(&bcm281xx_pinctrl_desc, &pdev->dev, pdata); - if (!pctl) { + if (IS_ERR(pctl)) { dev_err(&pdev->dev, "Failed to register pinctrl\n"); - return -ENODEV; + return PTR_ERR(pctl); } platform_set_drvdata(pdev, pdata); diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index 8d908e3..efcf2a2 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -1036,9 +1036,9 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) } pc->pctl_dev = pinctrl_register(&bcm2835_pinctrl_desc, dev, pc); - if (!pc->pctl_dev) { + if (IS_ERR(pc->pctl_dev)) { gpiochip_remove(&pc->gpio_chip); - return -EINVAL; + return PTR_ERR(pc->pctl_dev); } pc->gpio_range = bcm2835_pinctrl_gpio_range; diff --git a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c index bde45ba..6af538f 100644 --- a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c +++ b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c @@ -748,9 +748,9 @@ static int cygnus_gpio_register_pinconf(struct cygnus_gpio *chip) pctldesc->confops = &cygnus_pconf_ops; chip->pctl = pinctrl_register(pctldesc, chip->dev, chip); - if (!chip->pctl) { + if (IS_ERR(chip->pctl)) { dev_err(chip->dev, "unable to register pinctrl device\n"); - return -EINVAL; + return PTR_ERR(chip->pctl); } return 0; diff --git a/drivers/pinctrl/bcm/pinctrl-cygnus-mux.c b/drivers/pinctrl/bcm/pinctrl-cygnus-mux.c index f9a9283..9728f3d 100644 --- a/drivers/pinctrl/bcm/pinctrl-cygnus-mux.c +++ b/drivers/pinctrl/bcm/pinctrl-cygnus-mux.c @@ -989,9 +989,9 @@ static int cygnus_pinmux_probe(struct platform_device *pdev) pinctrl->pctl = pinctrl_register(&cygnus_pinctrl_desc, &pdev->dev, pinctrl); - if (!pinctrl->pctl) { + if (IS_ERR(pinctrl->pctl)) { dev_err(&pdev->dev, "unable to register Cygnus IOMUX pinctrl\n"); - return -EINVAL; + return PTR_ERR(pinctrl->pctl); } return 0; |