Skip to content

Commit d0f98e1

Browse files
Dan CarpenterJassi Brar
authored andcommitted
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: 5d4d263 ("mailbox: Introduce support for T-head TH1520 Mailbox driver") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Michal Wilczynski <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent 5bc55a3 commit d0f98e1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/mailbox/mailbox-th1520.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,10 @@ static void __iomem *th1520_map_mmio(struct platform_device *pdev,
387387

388388
mapped = devm_ioremap(&pdev->dev, res->start + offset,
389389
resource_size(res) - offset);
390-
if (IS_ERR(mapped))
390+
if (!mapped) {
391391
dev_err(&pdev->dev, "Failed to map resource: %s\n", res_name);
392+
return ERR_PTR(-ENOMEM);
393+
}
392394

393395
return mapped;
394396
}

0 commit comments

Comments
 (0)