mailbox: arm_mhuv2: Fix return value check in mhuv2_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 25 Nov 2022 06:35:48 +0000 (14:35 +0800)
committerJassi Brar <jaswinder.singh@linaro.org>
Mon, 19 Dec 2022 02:40:30 +0000 (20:40 -0600)
If devm_of_iomap() fails, it returns ERR_PTR() and never
return NULL, so replace NULL pointer check with IS_ERR()
to fix this problem.

Fixes: 5a6338cce9f4 ("mailbox: arm_mhuv2: Add driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/arm_mhuv2.c

index a47aef8df52fd6f3125987f98a47bc3afcd38944..c6d4957c4da83e6fa1cf39efdaa49f3efad362bb 100644 (file)
@@ -1062,8 +1062,8 @@ static int mhuv2_probe(struct amba_device *adev, const struct amba_id *id)
        int ret = -EINVAL;
 
        reg = devm_of_iomap(dev, dev->of_node, 0, NULL);
-       if (!reg)
-               return -ENOMEM;
+       if (IS_ERR(reg))
+               return PTR_ERR(reg);
 
        mhu = devm_kzalloc(dev, sizeof(*mhu), GFP_KERNEL);
        if (!mhu)