Commit 6b207ce8 authored by Jack Wang's avatar Jack Wang Committed by Jassi Brar

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: dbc049ee ("mailbox: Add driver for Broadcom FlexRM ring manager")
Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
Signed-off-by: default avatarJassi Brar <jaswinder.singh@linaro.org>
parent f5fe925d
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment