]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mailbox: zynqmp-ipi: Fix NULL vs IS_ERR() check in zynqmp_ipi_mbox_probe()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 29 Apr 2020 09:35:03 +0000 (09:35 +0000)
committerJassi Brar <jaswinder.singh@linaro.org>
Sat, 30 May 2020 23:08:40 +0000 (18:08 -0500)
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: ac21f3391114 ("mailbox: ZynqMP IPI mailbox controller")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/zynqmp-ipi-mailbox.c

index a4d176f160b8387665d59dcfcda5d81fd576bb3b..f44079d62b1a746b9d59b5c12a5648bc82d50185 100644 (file)
@@ -504,10 +504,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox,
                mchan->req_buf_size = resource_size(&res);
                mchan->req_buf = devm_ioremap(mdev, res.start,
                                              mchan->req_buf_size);
-               if (IS_ERR(mchan->req_buf)) {
+               if (!mchan->req_buf) {
                        dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-                       ret = PTR_ERR(mchan->req_buf);
-                       return ret;
+                       return -ENOMEM;
                }
        } else if (ret != -ENODEV) {
                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,
                mchan->resp_buf_size = resource_size(&res);
                mchan->resp_buf = devm_ioremap(mdev, res.start,
                                               mchan->resp_buf_size);
-               if (IS_ERR(mchan->resp_buf)) {
+               if (!mchan->resp_buf) {
                        dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-                       ret = PTR_ERR(mchan->resp_buf);
-                       return ret;
+                       return -ENOMEM;
                }
        } else if (ret != -ENODEV) {
                dev_err(mdev, "Unmatched resource %s.\n", name);
@@ -543,10 +541,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox,
                mchan->req_buf_size = resource_size(&res);
                mchan->req_buf = devm_ioremap(mdev, res.start,
                                              mchan->req_buf_size);
-               if (IS_ERR(mchan->req_buf)) {
+               if (!mchan->req_buf) {
                        dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-                       ret = PTR_ERR(mchan->req_buf);
-                       return ret;
+                       return -ENOMEM;
                }
        } else if (ret != -ENODEV) {
                dev_err(mdev, "Unmatched resource %s.\n", name);
@@ -559,10 +556,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox,
                mchan->resp_buf_size = resource_size(&res);
                mchan->resp_buf = devm_ioremap(mdev, res.start,
                                               mchan->resp_buf_size);
-               if (IS_ERR(mchan->resp_buf)) {
+               if (!mchan->resp_buf) {
                        dev_err(mdev, "Unable to map IPI buffer I/O memory\n");
-                       ret = PTR_ERR(mchan->resp_buf);
-                       return ret;
+                       return -ENOMEM;
                }
        } else if (ret != -ENODEV) {
                dev_err(mdev, "Unmatched resource %s.\n", name);