]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mailbox: th1520: Fix a NULL vs IS_ERR() bug
authorDan Carpenter <dan.carpenter@linaro.org>
Sat, 30 Nov 2024 10:07:39 +0000 (13:07 +0300)
committerJassi Brar <jassisinghbrar@gmail.com>
Sat, 18 Jan 2025 22:04:04 +0000 (16:04 -0600)
The devm_ioremap() function doesn't return error pointers, it returns
NULL.  Update the error checking to match.

Fixes: 5d4d263e1c6b ("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>
drivers/mailbox/mailbox-th1520.c

index 4e84640ac3b87645c562d9f228b0f0511fc7af63..e16e7c85ee3cd56301e88802f41d7a306a848074 100644 (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;
 }