diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2018-09-20 02:21:28 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-09-21 12:00:51 -0400 |
commit | 184744e9a0142f30d66ee369502c8f47d25a6928 (patch) | |
tree | fcfc7bbdc822c5dba69fe5020f113f498497cd97 /drivers/pinctrl/mediatek | |
parent | 69f8455f6cc78fa6cdf80d0105d7a748106271dc (diff) |
pinctrl: mediatek: paris: fix return value check in mtk_paris_pinctrl_probe()
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: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings")
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>
Diffstat (limited to 'drivers/pinctrl/mediatek')
-rw-r--r-- | drivers/pinctrl/mediatek/pinctrl-paris.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c index 4cf0fea30b7d..d2179028f134 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c | |||
@@ -836,8 +836,8 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev, | |||
836 | 836 | ||
837 | hw->base = devm_kmalloc_array(&pdev->dev, hw->soc->nbase_names, | 837 | hw->base = devm_kmalloc_array(&pdev->dev, hw->soc->nbase_names, |
838 | sizeof(*hw->base), GFP_KERNEL); | 838 | sizeof(*hw->base), GFP_KERNEL); |
839 | if (IS_ERR(hw->base)) | 839 | if (!hw->base) |
840 | return PTR_ERR(hw->base); | 840 | return -ENOMEM; |
841 | 841 | ||
842 | for (i = 0; i < hw->soc->nbase_names; i++) { | 842 | for (i = 0; i < hw->soc->nbase_names; i++) { |
843 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 843 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
@@ -863,8 +863,8 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev, | |||
863 | /* Copy from internal struct mtk_pin_desc to register to the core */ | 863 | /* Copy from internal struct mtk_pin_desc to register to the core */ |
864 | pins = devm_kmalloc_array(&pdev->dev, hw->soc->npins, sizeof(*pins), | 864 | pins = devm_kmalloc_array(&pdev->dev, hw->soc->npins, sizeof(*pins), |
865 | GFP_KERNEL); | 865 | GFP_KERNEL); |
866 | if (IS_ERR(pins)) | 866 | if (!pins) |
867 | return PTR_ERR(pins); | 867 | return -ENOMEM; |
868 | 868 | ||
869 | for (i = 0; i < hw->soc->npins; i++) { | 869 | for (i = 0; i < hw->soc->npins; i++) { |
870 | pins[i].number = hw->soc->pins[i].number; | 870 | pins[i].number = hw->soc->pins[i].number; |