summaryrefslogtreecommitdiff
path: root/drivers/mailbox/bcm-flexrm-mailbox.c
diff options
context:
space:
mode:
authorJack Wang <jinpu.wang@ionos.com>2022-08-26 13:13:35 +0300
committerJassi Brar <jaswinder.singh@linaro.org>2022-10-06 05:50:53 +0300
commit6b207ce8a96a71e966831e3a13c38143ba9a73c1 (patch)
tree28495ce50114bd68e8d89a0aa0168585d726904d /drivers/mailbox/bcm-flexrm-mailbox.c
parentf5fe925df802eb3c7a71a97c01cf371eea24ea6a (diff)
downloadlinux-6b207ce8a96a71e966831e3a13c38143ba9a73c1.tar.xz
mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg
dma_map_sg return 0 on error, fix the error check, and return -EIO to caller. Fixes: dbc049eee730 ("mailbox: Add driver for Broadcom FlexRM ring manager") Signed-off-by: Jack Wang <jinpu.wang@ionos.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Diffstat (limited to 'drivers/mailbox/bcm-flexrm-mailbox.c')
-rw-r--r--drivers/mailbox/bcm-flexrm-mailbox.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c
index fda16f76401e..bf6e86b0ed09 100644
--- a/drivers/mailbox/bcm-flexrm-mailbox.c
+++ b/drivers/mailbox/bcm-flexrm-mailbox.c
@@ -622,15 +622,15 @@ static int flexrm_spu_dma_map(struct device *dev, struct brcm_message *msg)
rc = dma_map_sg(dev, msg->spu.src, sg_nents(msg->spu.src),
DMA_TO_DEVICE);
- if (rc < 0)
- return rc;
+ if (!rc)
+ return -EIO;
rc = dma_map_sg(dev, msg->spu.dst, sg_nents(msg->spu.dst),
DMA_FROM_DEVICE);
- if (rc < 0) {
+ if (!rc) {
dma_unmap_sg(dev, msg->spu.src, sg_nents(msg->spu.src),
DMA_TO_DEVICE);
- return rc;
+ return -EIO;
}
return 0;