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>
Bu işleme şunda yer alıyor:
Masahiro Yamada
2015-06-09 13:01:16 +09:00
işlemeyi yapan: Linus Walleij
ebeveyn e73ac02dc1
işleme 323de9efdf
45 değiştirilmiş dosya ile 98 ekleme ve 95 silme

Dosyayı Görüntüle

@@ -4079,9 +4079,9 @@ static int atlas7_pinmux_probe(struct platform_device *pdev)
/* Now register the pin controller and all pins it handles */
pmx->pctl = pinctrl_register(&pmx->pctl_desc, &pdev->dev, pmx);
if (!pmx->pctl) {
if (IS_ERR(pmx->pctl)) {
dev_err(&pdev->dev, "could not register atlas7 pinmux driver\n");
ret = -EINVAL;
ret = PTR_ERR(pmx->pctl);
goto unmap_io;
}

Dosyayı Görüntüle

@@ -310,9 +310,9 @@ static int sirfsoc_pinmux_probe(struct platform_device *pdev)
/* Now register the pin controller and all pins it handles */
spmx->pmx = pinctrl_register(&sirfsoc_pinmux_desc, &pdev->dev, spmx);
if (!spmx->pmx) {
if (IS_ERR(spmx->pmx)) {
dev_err(&pdev->dev, "could not register SIRFSOC pinmux driver\n");
ret = -EINVAL;
ret = PTR_ERR(spmx->pmx);
goto out_no_pmx;
}