pinctrl: make pinctrl_register() return proper error code
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 9 Jun 2015 04:01:16 +0000 (13:01 +0900)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 10 Jun 2015 12:49:52 +0000 (14:49 +0200)
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>
45 files changed:
drivers/pinctrl/bcm/pinctrl-bcm281xx.c
drivers/pinctrl/bcm/pinctrl-bcm2835.c
drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
drivers/pinctrl/bcm/pinctrl-cygnus-mux.c
drivers/pinctrl/berlin/berlin.c
drivers/pinctrl/core.c
drivers/pinctrl/freescale/pinctrl-imx.c
drivers/pinctrl/freescale/pinctrl-imx1-core.c
drivers/pinctrl/freescale/pinctrl-mxs.c
drivers/pinctrl/intel/pinctrl-cherryview.c
drivers/pinctrl/intel/pinctrl-intel.c
drivers/pinctrl/mediatek/pinctrl-mtk-common.c
drivers/pinctrl/meson/pinctrl-meson.c
drivers/pinctrl/mvebu/pinctrl-mvebu.c
drivers/pinctrl/nomadik/pinctrl-abx500.c
drivers/pinctrl/nomadik/pinctrl-nomadik.c
drivers/pinctrl/pinctrl-adi2.c
drivers/pinctrl/pinctrl-amd.c
drivers/pinctrl/pinctrl-as3722.c
drivers/pinctrl/pinctrl-at91.c
drivers/pinctrl/pinctrl-lantiq.c
drivers/pinctrl/pinctrl-lpc18xx.c
drivers/pinctrl/pinctrl-palmas.c
drivers/pinctrl/pinctrl-pistachio.c
drivers/pinctrl/pinctrl-rockchip.c
drivers/pinctrl/pinctrl-single.c
drivers/pinctrl/pinctrl-st.c
drivers/pinctrl/pinctrl-tb10x.c
drivers/pinctrl/pinctrl-tegra-xusb.c
drivers/pinctrl/pinctrl-tegra.c
drivers/pinctrl/pinctrl-tz1090-pdc.c
drivers/pinctrl/pinctrl-tz1090.c
drivers/pinctrl/pinctrl-u300.c
drivers/pinctrl/pinctrl-zynq.c
drivers/pinctrl/qcom/pinctrl-msm.c
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
drivers/pinctrl/samsung/pinctrl-exynos5440.c
drivers/pinctrl/samsung/pinctrl-samsung.c
drivers/pinctrl/sh-pfc/pinctrl.c
drivers/pinctrl/sirf/pinctrl-atlas7.c
drivers/pinctrl/sirf/pinctrl-sirf.c
drivers/pinctrl/spear/pinctrl-spear.c
drivers/pinctrl/sunxi/pinctrl-sunxi.c
drivers/pinctrl/vt8500/pinctrl-wmt.c

index 9641f1c7617eab98672f3e4a7136ca42af5c85ff..c3c692e508e8f90913018bd9052513e993c015db 100644 (file)
@@ -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);
index 8d908e3f42c3d1b89c4f9ac45c7566f00af8b317..efcf2a2b3975c2cc35fda3806223f0578900d4c2 100644 (file)
@@ -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;
index bde45ba8d7107f8be7efdefc497f1012bc5a947c..6af538f67decd75898a4dfd671050a84a4b3fbe6 100644 (file)
@@ -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;
index f9a9283caf8188fd39d9a4185fd7d2dea52e6ec7..9728f3db9126eabf2f858b9f7d7f14555fa6e3bf 100644 (file)
@@ -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;
index 7f0b0f93242b7240198283896cce5276f29006f7..ddbcd1d7de5239e87ffb7df9d719221ea971dc7c 100644 (file)
@@ -320,9 +320,9 @@ int berlin_pinctrl_probe(struct platform_device *pdev,
        }
 
        pctrl->pctrl_dev = pinctrl_register(&berlin_pctrl_desc, dev, pctrl);
-       if (!pctrl->pctrl_dev) {
+       if (IS_ERR(pctrl->pctrl_dev)) {
                dev_err(dev, "failed to register pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(pctrl->pctrl_dev);
        }
 
        return 0;
index b01ee72811303ae64c4c4d858125abae82beb3da..804d126b7065644be5d49659ad3bae3a2be7bfcd 100644 (file)
@@ -1706,14 +1706,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
        int ret;
 
        if (!pctldesc)
-               return NULL;
+               return ERR_PTR(-EINVAL);
        if (!pctldesc->name)
-               return NULL;
+               return ERR_PTR(-EINVAL);
 
        pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL);
        if (pctldev == NULL) {
                dev_err(dev, "failed to alloc struct pinctrl_dev\n");
-               return NULL;
+               return ERR_PTR(-ENOMEM);
        }
 
        /* Initialize pin control device struct */
@@ -1726,20 +1726,23 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
        mutex_init(&pctldev->mutex);
 
        /* check core ops for sanity */
-       if (pinctrl_check_ops(pctldev)) {
+       ret = pinctrl_check_ops(pctldev);
+       if (ret) {
                dev_err(dev, "pinctrl ops lacks necessary functions\n");
                goto out_err;
        }
 
        /* If we're implementing pinmuxing, check the ops for sanity */
        if (pctldesc->pmxops) {
-               if (pinmux_check_ops(pctldev))
+               ret = pinmux_check_ops(pctldev);
+               if (ret)
                        goto out_err;
        }
 
        /* If we're implementing pinconfig, check the ops for sanity */
        if (pctldesc->confops) {
-               if (pinconf_check_ops(pctldev))
+               ret = pinconf_check_ops(pctldev);
+               if (ret)
                        goto out_err;
        }
 
@@ -1785,7 +1788,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
 out_err:
        mutex_destroy(&pctldev->mutex);
        kfree(pctldev);
-       return NULL;
+       return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(pinctrl_register);
 
index e73e1edb0fe1437b8fac4d48c66c8caa5add079d..d7b98ba36825b2a7b7008c46a558ceeb02b6120f 100644 (file)
@@ -727,9 +727,9 @@ int imx_pinctrl_probe(struct platform_device *pdev,
        ipctl->dev = info->dev;
        platform_set_drvdata(pdev, ipctl);
        ipctl->pctl = pinctrl_register(&imx_pinctrl_desc, &pdev->dev, ipctl);
-       if (!ipctl->pctl) {
+       if (IS_ERR(ipctl->pctl)) {
                dev_err(&pdev->dev, "could not register IMX pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(ipctl->pctl);
        }
 
        dev_info(&pdev->dev, "initialized IMX pinctrl driver\n");
index 5ac59fbb2440ffdc5ea7130ffc6c3ca0548617fa..5fd4437cee1584a6cc7a5251269d1078a0b62ddf 100644 (file)
@@ -633,9 +633,9 @@ int imx1_pinctrl_core_probe(struct platform_device *pdev,
        ipctl->dev = info->dev;
        platform_set_drvdata(pdev, ipctl);
        ipctl->pctl = pinctrl_register(pctl_desc, &pdev->dev, ipctl);
-       if (!ipctl->pctl) {
+       if (IS_ERR(ipctl->pctl)) {
                dev_err(&pdev->dev, "could not register IMX pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(ipctl->pctl);
        }
 
        ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
index 646d5c244af11df315259660c5047c4f239ad6ff..f64eecb24755d778c250925bd377408981b4195d 100644 (file)
@@ -540,9 +540,9 @@ int mxs_pinctrl_probe(struct platform_device *pdev,
        }
 
        d->pctl = pinctrl_register(&mxs_pinctrl_desc, &pdev->dev, d);
-       if (!d->pctl) {
+       if (IS_ERR(d->pctl)) {
                dev_err(&pdev->dev, "Couldn't register MXS pinctrl driver\n");
-               ret = -EINVAL;
+               ret = PTR_ERR(d->pctl);
                goto err;
        }
 
index 82f691eeeec4d82cd5e75b7a96be719befbcd57f..9bed70b3ec94fa2b24d5a4dd78b9ab7d8816b77b 100644 (file)
@@ -1489,9 +1489,9 @@ static int chv_pinctrl_probe(struct platform_device *pdev)
        pctrl->pctldesc.npins = pctrl->community->npins;
 
        pctrl->pctldev = pinctrl_register(&pctrl->pctldesc, &pdev->dev, pctrl);
-       if (!pctrl->pctldev) {
+       if (IS_ERR(pctrl->pctldev)) {
                dev_err(&pdev->dev, "failed to register pinctrl driver\n");
-               return -ENODEV;
+               return PTR_ERR(pctrl->pctldev);
        }
 
        ret = chv_gpio_probe(pctrl, irq);
index 00768e53deec0061d42e467fa42690879459015c..f9ee0d68b2888c6ba396f3f1ec8bd716eb5aa20e 100644 (file)
@@ -1021,9 +1021,9 @@ int intel_pinctrl_probe(struct platform_device *pdev,
        pctrl->pctldesc.npins = pctrl->soc->npins;
 
        pctrl->pctldev = pinctrl_register(&pctrl->pctldesc, &pdev->dev, pctrl);
-       if (!pctrl->pctldev) {
+       if (IS_ERR(pctrl->pctldev)) {
                dev_err(&pdev->dev, "failed to register pinctrl driver\n");
-               return -ENODEV;
+               return PTR_ERR(pctrl->pctldev);
        }
 
        ret = intel_gpio_probe(pctrl, irq);
index f206a54a3ca49a515c6b1de1bb67e1eb44a6cbda..35f7b014af65db074db70bc23899bc751f215081 100644 (file)
@@ -1269,9 +1269,9 @@ int mtk_pctrl_init(struct platform_device *pdev,
        mtk_pctrl_desc.npins = pctl->devdata->npins;
        pctl->dev = &pdev->dev;
        pctl->pctl_dev = pinctrl_register(&mtk_pctrl_desc, &pdev->dev, pctl);
-       if (!pctl->pctl_dev) {
+       if (IS_ERR(pctl->pctl_dev)) {
                dev_err(&pdev->dev, "couldn't register pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(pctl->pctl_dev);
        }
 
        pctl->chip = devm_kzalloc(&pdev->dev, sizeof(*pctl->chip), GFP_KERNEL);
index edcd140e089968e0f7b95fef4ffcd82f157f8294..7b203bf118d95610042fd47b535c3c75836b9311 100644 (file)
@@ -738,9 +738,9 @@ static int meson_pinctrl_probe(struct platform_device *pdev)
        pc->desc.npins          = pc->data->num_pins;
 
        pc->pcdev = pinctrl_register(&pc->desc, pc->dev, pc);
-       if (!pc->pcdev) {
+       if (IS_ERR(pc->pcdev)) {
                dev_err(pc->dev, "can't register pinctrl device");
-               return -EINVAL;
+               return PTR_ERR(pc->pcdev);
        }
 
        ret = meson_gpiolib_register(pc);
index f3b426cdaf8f16116c591a317ba98486824d40eb..77d2221d379da41c95c195eb77ccbe38d9088191 100644 (file)
@@ -706,9 +706,9 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
        }
 
        pctl->pctldev = pinctrl_register(&pctl->desc, &pdev->dev, pctl);
-       if (!pctl->pctldev) {
+       if (IS_ERR(pctl->pctldev)) {
                dev_err(&pdev->dev, "unable to register pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(pctl->pctldev);
        }
 
        dev_info(&pdev->dev, "registered pinctrl driver\n");
index 15ccafd74dc64c366352a56da876ed546c618ab1..557d0f2a3031b1a0295fe60796ec17ea7817fc52 100644 (file)
@@ -1235,10 +1235,10 @@ static int abx500_gpio_probe(struct platform_device *pdev)
        abx500_pinctrl_desc.pins = pct->soc->pins;
        abx500_pinctrl_desc.npins = pct->soc->npins;
        pct->pctldev = pinctrl_register(&abx500_pinctrl_desc, &pdev->dev, pct);
-       if (!pct->pctldev) {
+       if (IS_ERR(pct->pctldev)) {
                dev_err(&pdev->dev,
                        "could not register abx500 pinctrl driver\n");
-               ret = -EINVAL;
+               ret = PTR_ERR(pct->pctldev);
                goto out_rem_chip;
        }
        dev_info(&pdev->dev, "registered pin controller\n");
index 2589304e76d1e82592bb4aa4e7bc3469eb93a521..809d88445db5aa8acd4b1f73fdc993b36812b6c9 100644 (file)
@@ -2029,9 +2029,9 @@ static int nmk_pinctrl_probe(struct platform_device *pdev)
        npct->dev = &pdev->dev;
 
        npct->pctl = pinctrl_register(&nmk_pinctrl_desc, &pdev->dev, npct);
-       if (!npct->pctl) {
+       if (IS_ERR(npct->pctl)) {
                dev_err(&pdev->dev, "could not register Nomadik pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(npct->pctl);
        }
 
        /* We will handle a range of GPIO pins */
index 49df9037b41e130b5a9a5166bade3a5f59de0897..873433da0f2ce192651aa9003946399d16e82a0f 100644 (file)
@@ -1070,9 +1070,9 @@ static int adi_pinctrl_probe(struct platform_device *pdev)
 
        /* Now register the pin controller and all pins it handles */
        pinctrl->pctl = pinctrl_register(&adi_pinmux_desc, &pdev->dev, pinctrl);
-       if (!pinctrl->pctl) {
+       if (IS_ERR(pinctrl->pctl)) {
                dev_err(&pdev->dev, "could not register pinctrl ADI2 driver\n");
-               return -EINVAL;
+               return PTR_ERR(pinctrl->pctl);
        }
 
        platform_set_drvdata(pdev, pinctrl);
index e74791254c9ca7714e77184940ea18bdbdae23d9..d8e3f7c7fea35c62c9c2451358720de3a80634d1 100644 (file)
@@ -789,9 +789,9 @@ static int amd_gpio_probe(struct platform_device *pdev)
        amd_pinctrl_desc.name = dev_name(&pdev->dev);
        gpio_dev->pctrl = pinctrl_register(&amd_pinctrl_desc,
                                        &pdev->dev, gpio_dev);
-       if (!gpio_dev->pctrl) {
+       if (IS_ERR(gpio_dev->pctrl)) {
                dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-               return -ENODEV;
+               return PTR_ERR(gpio_dev->pctrl);
        }
 
        ret = gpiochip_add(&gpio_dev->gc);
index db0571ffbe99e2241687384fcf779f4d4e186a4a..4747e08f5389c36698c3916453e5284d77f8e476 100644 (file)
@@ -586,9 +586,9 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
        as3722_pinctrl_desc.npins = ARRAY_SIZE(as3722_pins_desc);
        as_pci->pctl = pinctrl_register(&as3722_pinctrl_desc,
                                        &pdev->dev, as_pci);
-       if (!as_pci->pctl) {
+       if (IS_ERR(as_pci->pctl)) {
                dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(as_pci->pctl);
        }
 
        as_pci->gpio_chip = as3722_gpio_chip;
index d80ade23fd1bb454bf172b538a60921e7a336058..a0824477072bd174ca17de14adf75c144f62c907 100644 (file)
@@ -1238,9 +1238,9 @@ static int at91_pinctrl_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, info);
        info->pctl = pinctrl_register(&at91_pinctrl_desc, &pdev->dev, info);
 
-       if (!info->pctl) {
+       if (IS_ERR(info->pctl)) {
                dev_err(&pdev->dev, "could not register AT91 pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(info->pctl);
        }
 
        /* We will handle a range of GPIO pins */
index 296e5b37f7682ac765dc78ef33edbbf93abfab2c..fc38a85405444316d0f62904be77734f44c35318 100644 (file)
@@ -337,9 +337,9 @@ int ltq_pinctrl_register(struct platform_device *pdev,
        info->dev = &pdev->dev;
 
        info->pctrl = pinctrl_register(desc, &pdev->dev, info);
-       if (!info->pctrl) {
+       if (IS_ERR(info->pctrl)) {
                dev_err(&pdev->dev, "failed to register LTQ pinmux driver\n");
-               return -EINVAL;
+               return PTR_ERR(info->pctrl);
        }
        platform_set_drvdata(pdev, info);
        return 0;
index a8bc1ad4e73f8656530c87b18cbcb6c79dfad4fa..ef0b697639a71e397ec545d17f6fe9ae9cec445d 100644 (file)
@@ -1180,10 +1180,10 @@ static int lpc18xx_scu_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, scu);
 
        scu->pctl = pinctrl_register(&lpc18xx_scu_desc, &pdev->dev, scu);
-       if (!scu->pctl) {
+       if (IS_ERR(scu->pctl)) {
                dev_err(&pdev->dev, "Could not register pinctrl driver\n");
                clk_disable_unprepare(scu->clk);
-               return -EINVAL;
+               return PTR_ERR(scu->pctl);
        }
 
        return 0;
index 2631df0504bd62a9edd519ad6824f8c4f7e6a879..f7e168044baf9cc3640414cdaf3e671b3e1ae897 100644 (file)
@@ -1044,9 +1044,9 @@ static int palmas_pinctrl_probe(struct platform_device *pdev)
        palmas_pinctrl_desc.pins = palmas_pins_desc;
        palmas_pinctrl_desc.npins = ARRAY_SIZE(palmas_pins_desc);
        pci->pctl = pinctrl_register(&palmas_pinctrl_desc, &pdev->dev, pci);
-       if (!pci->pctl) {
+       if (IS_ERR(pci->pctl)) {
                dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-               return -ENODEV;
+               return PTR_ERR(pci->pctl);
        }
        return 0;
 }
index 079ce8b13697cc70dc96c521ec806360259c374b..63100be8101520d0c3fb51cd08dd1603b4919b37 100644 (file)
@@ -1474,9 +1474,9 @@ static int pistachio_pinctrl_probe(struct platform_device *pdev)
 
        pctl->pctldev = pinctrl_register(&pistachio_pinctrl_desc, &pdev->dev,
                                         pctl);
-       if (!pctl->pctldev) {
+       if (IS_ERR(pctl->pctldev)) {
                dev_err(&pdev->dev, "Failed to register pinctrl device\n");
-               return -EINVAL;
+               return PTR_ERR(pctl->pctldev);
        }
 
        ret = pistachio_gpio_register(pctl);
index dee7d5f06c6013d42de9889530f3087f4838cb67..6e7643f7f2a0f0b31829d7057416b314603c53be 100644 (file)
@@ -1274,9 +1274,9 @@ static int rockchip_pinctrl_register(struct platform_device *pdev,
                return ret;
 
        info->pctl_dev = pinctrl_register(ctrldesc, &pdev->dev, info);
-       if (!info->pctl_dev) {
+       if (IS_ERR(info->pctl_dev)) {
                dev_err(&pdev->dev, "could not register pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(info->pctl_dev);
        }
 
        for (bank = 0; bank < info->ctrl->nr_banks; ++bank) {
index 968e352c595fb412f88700d7c4c29f545977e228..b2de09d3b1a0c8e14b03e23fcb0131e6f41022ee 100644 (file)
@@ -1921,9 +1921,9 @@ static int pcs_probe(struct platform_device *pdev)
                goto free;
 
        pcs->pctl = pinctrl_register(&pcs->desc, pcs->dev, pcs);
-       if (!pcs->pctl) {
+       if (IS_ERR(pcs->pctl)) {
                dev_err(pcs->dev, "could not register single pinctrl driver\n");
-               ret = -EINVAL;
+               ret = PTR_ERR(pcs->pctl);
                goto free;
        }
 
index 65bf73b70e3406c72db02f796840fa6296bbdcb9..d34ac879af9ef302f7b80906ff75db23d6b21217 100644 (file)
@@ -1737,9 +1737,9 @@ static int st_pctl_probe(struct platform_device *pdev)
        pctl_desc->name         = dev_name(&pdev->dev);
 
        info->pctl = pinctrl_register(pctl_desc, &pdev->dev, info);
-       if (!info->pctl) {
+       if (IS_ERR(info->pctl)) {
                dev_err(&pdev->dev, "Failed pinctrl registration\n");
-               return -EINVAL;
+               return PTR_ERR(info->pctl);
        }
 
        for (i = 0; i < info->nbanks; i++)
index 160a1f5e989648ebf21ae863194c216b2af85181..6546b9bb2e060d5227b868ff49eaef36d534fff4 100644 (file)
@@ -807,9 +807,9 @@ static int tb10x_pinctrl_probe(struct platform_device *pdev)
        }
 
        state->pctl = pinctrl_register(&tb10x_pindesc, dev, state);
-       if (!state->pctl) {
+       if (IS_ERR(state->pctl)) {
                dev_err(dev, "could not register TB10x pin driver\n");
-               ret = -EINVAL;
+               ret = PTR_ERR(state->pctl);
                goto fail;
        }
 
index 6a6eebfb29308b4c1b024b75a7e3af4e409256d7..2651d04bd1beb8a59b9487fad6d2da1acc4ac18c 100644 (file)
@@ -922,9 +922,9 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
        padctl->desc.owner = THIS_MODULE;
 
        padctl->pinctrl = pinctrl_register(&padctl->desc, &pdev->dev, padctl);
-       if (!padctl->pinctrl) {
+       if (IS_ERR(padctl->pinctrl)) {
                dev_err(&pdev->dev, "failed to register pincontrol\n");
-               err = -ENODEV;
+               err = PTR_ERR(padctl->pinctrl);
                goto reset;
        }
 
index 4c95c2024a1c24496d731a8ffc0fc056857228a0..0f982b829be1f83317a6fa6449efeb9e5de05461 100644 (file)
@@ -703,9 +703,9 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
        }
 
        pmx->pctl = pinctrl_register(&tegra_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);
        }
 
        pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
index 8a8911bb883a2007d83f6fc53bacfc440ba5c103..c349911708ef8e98b868dc0ed39ceec9b72f3605 100644 (file)
@@ -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);
index fc5594a530c2f9770f0e8db92c7874b91a643c37..6d07a2f64d978439d06ec15e47f5c65ab83945b6 100644 (file)
@@ -1963,9 +1963,9 @@ static int tz1090_pinctrl_probe(struct platform_device *pdev)
                return PTR_ERR(pmx->regs);
 
        pmx->pctl = pinctrl_register(&tz1090_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);
index f931e65aba3a47051df623a1c146fb5cf9a4c758..c076021f37d20b6a643e912686957049afd740be 100644 (file)
@@ -1068,9 +1068,9 @@ static int u300_pmx_probe(struct platform_device *pdev)
                return PTR_ERR(upmx->virtbase);
 
        upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx);
-       if (!upmx->pctl) {
+       if (IS_ERR(upmx->pctl)) {
                dev_err(&pdev->dev, "could not register U300 pinmux driver\n");
-               return -EINVAL;
+               return PTR_ERR(upmx->pctl);
        }
 
        platform_set_drvdata(pdev, upmx);
index 40b2affcbeef21e3fc3217a9a0c5056786c23449..7ce23b6282adf1bc33d59d3a240b556395757827 100644 (file)
@@ -1196,8 +1196,8 @@ static int zynq_pinctrl_probe(struct platform_device *pdev)
        pctrl->nfuncs = ARRAY_SIZE(zynq_pmux_functions);
 
        pctrl->pctrl = pinctrl_register(&zynq_desc, &pdev->dev, pctrl);
-       if (!pctrl->pctrl)
-               return -ENOMEM;
+       if (IS_ERR(pctrl->pctrl))
+               return PTR_ERR(pctrl->pctrl);
 
        platform_set_drvdata(pdev, pctrl);
 
index f3d800f796c2f48c4a7c6c5e6b71d23dbc8cbb31..e457d52302a2023f06786b0138de67b6496a37df 100644 (file)
@@ -906,9 +906,9 @@ int msm_pinctrl_probe(struct platform_device *pdev,
        msm_pinctrl_desc.pins = pctrl->soc->pins;
        msm_pinctrl_desc.npins = pctrl->soc->npins;
        pctrl->pctrl = pinctrl_register(&msm_pinctrl_desc, &pdev->dev, pctrl);
-       if (!pctrl->pctrl) {
+       if (IS_ERR(pctrl->pctrl)) {
                dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-               return -ENODEV;
+               return PTR_ERR(pctrl->pctrl);
        }
 
        ret = msm_gpio_init(pctrl);
index b2d22218a2582f94b2c5d0274843fa0c2d3d7162..f92f229b6d65257d3c1c1ae033febc1efe476daf 100644 (file)
@@ -776,8 +776,8 @@ static int pmic_gpio_probe(struct platform_device *pdev)
        state->chip.can_sleep = false;
 
        state->ctrl = pinctrl_register(pctrldesc, dev, state);
-       if (!state->ctrl)
-               return -ENODEV;
+       if (IS_ERR(state->ctrl))
+               return PTR_ERR(state->ctrl);
 
        ret = gpiochip_add(&state->chip);
        if (ret) {
index 8f36c5f9194903fd8433736499a03a61afbfb2ac..cd7ca113cc93c351512a235e49d015afea71797d 100644 (file)
@@ -890,8 +890,8 @@ static int pmic_mpp_probe(struct platform_device *pdev)
        state->chip.can_sleep = false;
 
        state->ctrl = pinctrl_register(pctrldesc, dev, state);
-       if (!state->ctrl)
-               return -ENODEV;
+       if (IS_ERR(state->ctrl))
+               return PTR_ERR(state->ctrl);
 
        ret = gpiochip_add(&state->chip);
        if (ret) {
index 86192be3b67970392aeb2ab37775c664060ea9d3..f5619fb504473a5f5e00ca043435941b81aa5c2e 100644 (file)
@@ -822,9 +822,9 @@ static int exynos5440_pinctrl_register(struct platform_device *pdev,
                return ret;
 
        pctl_dev = pinctrl_register(ctrldesc, &pdev->dev, priv);
-       if (!pctl_dev) {
+       if (IS_ERR(pctl_dev)) {
                dev_err(&pdev->dev, "could not register pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(pctl_dev);
        }
 
        grange.name = "exynos5440-pctrl-gpio-range";
index 0fd20c5ffde9951c9a8e00ba9786e7c82da3623a..3dd5a3b2ac62344a19713e92d9e7ad8fa5cf2461 100644 (file)
@@ -873,9 +873,9 @@ static int samsung_pinctrl_register(struct platform_device *pdev,
                return ret;
 
        drvdata->pctl_dev = pinctrl_register(ctrldesc, &pdev->dev, drvdata);
-       if (!drvdata->pctl_dev) {
+       if (IS_ERR(drvdata->pctl_dev)) {
                dev_err(&pdev->dev, "could not register pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(drvdata->pctl_dev);
        }
 
        for (bank = 0; bank < drvdata->nr_banks; ++bank) {
index 072e7c62cab7dc0f6f254381d377a808423f863b..ff678966008b7cfd29472a996361def75f3a7e26 100644 (file)
@@ -625,8 +625,8 @@ int sh_pfc_register_pinctrl(struct sh_pfc *pfc)
        pmx->pctl_desc.npins = pfc->info->nr_pins;
 
        pmx->pctl = pinctrl_register(&pmx->pctl_desc, pfc->dev, pmx);
-       if (pmx->pctl == NULL)
-               return -EINVAL;
+       if (IS_ERR(pmx->pctl))
+               return PTR_ERR(pmx->pctl);
 
        return 0;
 }
index c2ced3f68768c14bb2fd121d59623241971a66c7..9384e0aa399603b6f0348d342d4fd264c18172ea 100644 (file)
@@ -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;
        }
 
index e2efbbae4061301cf60f3a55a104ea553ad2e7ad..8ba26e45499a35a41f31682336acfb0d133f6820 100644 (file)
@@ -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;
        }
 
index abdb05ac43dc2e2a7c55aaa0cd853e0609879b8c..f87a5eaf75dab42129491a07e1ba148baec0ef82 100644 (file)
@@ -396,9 +396,9 @@ int spear_pinctrl_probe(struct platform_device *pdev,
        spear_pinctrl_desc.npins = machdata->npins;
 
        pmx->pctl = pinctrl_register(&spear_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);
        }
 
        return 0;
index f8e171b7669380d3d1f018124e04488fd4682f8f..d7857c72e627d9c65d8c21446d9f4392b1ccbb6c 100644 (file)
@@ -911,9 +911,9 @@ int sunxi_pinctrl_init(struct platform_device *pdev,
 
        pctl->pctl_dev = pinctrl_register(pctrl_desc,
                                          &pdev->dev, pctl);
-       if (!pctl->pctl_dev) {
+       if (IS_ERR(pctl->pctl_dev)) {
                dev_err(&pdev->dev, "couldn't register pinctrl driver\n");
-               return -EINVAL;
+               return PTR_ERR(pctl->pctl_dev);
        }
 
        pctl->chip = devm_kzalloc(&pdev->dev, sizeof(*pctl->chip), GFP_KERNEL);
index d055d63309e4e6b303208ed729eac28322e6a09d..c15316b003c578b430106f1a6f4a3c76b3b90d9b 100644 (file)
@@ -594,9 +594,9 @@ int wmt_pinctrl_probe(struct platform_device *pdev,
        data->dev = &pdev->dev;
 
        data->pctl_dev = pinctrl_register(&wmt_desc, &pdev->dev, data);
-       if (!data->pctl_dev) {
+       if (IS_ERR(data->pctl_dev)) {
                dev_err(&pdev->dev, "Failed to register pinctrl\n");
-               return -EINVAL;
+               return PTR_ERR(data->pctl_dev);
        }
 
        err = gpiochip_add(&data->gpio_chip);