Skip to content

Commit 445aeeb

Browse files
Wei YongjunJassiBrar
authored andcommitted
mailbox: zynqmp-ipi: Fix NULL vs IS_ERR() check in zynqmp_ipi_mbox_probe()
In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). So we should check whether the return value of devm_ioremap() is NULL instead of IS_ERR. Fixes: 4981b82 ("mailbox: ZynqMP IPI mailbox controller") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent 9d8ca62 commit 445aeeb

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

drivers/mailbox/zynqmp-ipi-mailbox.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox,
504504
mchan->req_buf_size = resource_size(&res);
505505
mchan->req_buf = devm_ioremap(mdev, res.start,
506506
mchan->req_buf_size);
507-
if (IS_ERR(mchan->req_buf)) {
507+
if (!mchan->req_buf) {
508508
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
509-
ret = PTR_ERR(mchan->req_buf);
510-
return ret;
509+
return -ENOMEM;
511510
}
512511
} else if (ret != -ENODEV) {
513512
dev_err(mdev, "Unmatched resource %s, %d.\n", name, ret);
@@ -520,10 +519,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox,
520519
mchan->resp_buf_size = resource_size(&res);
521520
mchan->resp_buf = devm_ioremap(mdev, res.start,
522521
mchan->resp_buf_size);
523-
if (IS_ERR(mchan->resp_buf)) {
522+
if (!mchan->resp_buf) {
524523
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
525-
ret = PTR_ERR(mchan->resp_buf);
526-
return ret;
524+
return -ENOMEM;
527525
}
528526
} else if (ret != -ENODEV) {
529527
dev_err(mdev, "Unmatched resource %s.\n", name);
@@ -543,10 +541,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox,
543541
mchan->req_buf_size = resource_size(&res);
544542
mchan->req_buf = devm_ioremap(mdev, res.start,
545543
mchan->req_buf_size);
546-
if (IS_ERR(mchan->req_buf)) {
544+
if (!mchan->req_buf) {
547545
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
548-
ret = PTR_ERR(mchan->req_buf);
549-
return ret;
546+
return -ENOMEM;
550547
}
551548
} else if (ret != -ENODEV) {
552549
dev_err(mdev, "Unmatched resource %s.\n", name);
@@ -559,10 +556,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox,
559556
mchan->resp_buf_size = resource_size(&res);
560557
mchan->resp_buf = devm_ioremap(mdev, res.start,
561558
mchan->resp_buf_size);
562-
if (IS_ERR(mchan->resp_buf)) {
559+
if (!mchan->resp_buf) {
563560
dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
564-
ret = PTR_ERR(mchan->resp_buf);
565-
return ret;
561+
return -ENOMEM;
566562
}
567563
} else if (ret != -ENODEV) {
568564
dev_err(mdev, "Unmatched resource %s.\n", name);

0 commit comments

Comments
 (0)