pinctrl: mediatek: moore: fix return value check in mtk_moore_pinctrl_probe()
authorWei Yongjun <weiyongjun1@huawei.com>
Thu, 20 Sep 2018 06:21:50 +0000 (06:21 +0000)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 21 Sep 2018 16:08:18 +0000 (09:08 -0700)
In case of error, the function devm_kmalloc_array() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: b7d7f9eeca55 ("pinctrl: mediatek: extend struct mtk_pin_desc which per-pin driver depends on")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/mediatek/pinctrl-moore.c

index c27597cd3931d0ad3431c62de2634011d8eecc37..3bf5dd55274929d30f9fb56322c85d451ec27186 100644 (file)
@@ -608,8 +608,8 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev,
 
        hw->base = devm_kmalloc_array(&pdev->dev, hw->soc->nbase_names,
                                      sizeof(*hw->base), GFP_KERNEL);
-       if (IS_ERR(hw->base))
-               return PTR_ERR(hw->base);
+       if (!hw->base)
+               return -ENOMEM;
 
        for (i = 0; i < hw->soc->nbase_names; i++) {
                res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
@@ -629,8 +629,8 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev,
        /* Copy from internal struct mtk_pin_desc to register to the core */
        pins = devm_kmalloc_array(&pdev->dev, hw->soc->npins, sizeof(*pins),
                                  GFP_KERNEL);
-       if (IS_ERR(pins))
-               return PTR_ERR(pins);
+       if (!pins)
+               return -ENOMEM;
 
        for (i = 0; i < hw->soc->npins; i++) {
                pins[i].number = hw->soc->pins[i].number;