Skip to content

Commit

Permalink
mailbox: arm_mhuv2: Fix return value check in mhuv2_probe()
Browse files Browse the repository at this point in the history
[ Upstream commit 165b764 ]

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: 5a6338c ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yang Yingliang authored and gregkh committed Dec 31, 2022
1 parent 28604a9 commit 550f403
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/mailbox/arm_mhuv2.c
Expand Up @@ -1061,8 +1061,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)
Expand Down

0 comments on commit 550f403

Please sign in to comment.