mailbox: th1520: Fix a NULL vs IS_ERR() bug

The devm_ioremap() function doesn't return error pointers, it returns
NULL.  Update the error checking to match.

Fixes: 5d4d263e1c ("mailbox: Introduce support for T-head TH1520 Mailbox driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Michal Wilczynski <m.wilczynski@samsung.com>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
This commit is contained in:
Dan Carpenter 2024-11-30 13:07:39 +03:00 committed by Jassi Brar
parent 5bc55a333a
commit d0f98e14c0

View File

@ -387,8 +387,10 @@ static void __iomem *th1520_map_mmio(struct platform_device *pdev,
mapped = devm_ioremap(&pdev->dev, res->start + offset,
resource_size(res) - offset);
if (IS_ERR(mapped))
if (!mapped) {
dev_err(&pdev->dev, "Failed to map resource: %s\n", res_name);
return ERR_PTR(-ENOMEM);
}
return mapped;
}