]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg
authorJack Wang <jinpu.wang@ionos.com>
Fri, 26 Aug 2022 10:13:35 +0000 (12:13 +0200)
committerJassi Brar <jaswinder.singh@linaro.org>
Thu, 6 Oct 2022 02:50:53 +0000 (21:50 -0500)
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>
drivers/mailbox/bcm-flexrm-mailbox.c

index fda16f76401e0732f7dd2b2aa4be18c6022f949e..bf6e86b0ed09cd1cc9c5a543d94ca5b965f500c8 100644 (file)
@@ -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;