[PATCH] dma: xilinx: check the return value of dma_set_mask() in zynqmp_dma_probe()

Jia-Ju Bai baijiaju1990 at gmail.com
Wed Mar 2 18:43:34 PST 2022


The function dma_set_mask() in zynqmp_dma_probe() can fail, so its
return value should be checked.

Fixes: b0cc417c1637 ("dmaengine: Add Xilinx zynqmp dma engine driver support")
Reported-by: TOTE Robot <oslab at tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990 at gmail.com>
---
 drivers/dma/xilinx/zynqmp_dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index 7aa63b652027..963fb1de93af 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -1050,7 +1050,8 @@ static int zynqmp_dma_probe(struct platform_device *pdev)
 	zdev->dev = &pdev->dev;
 	INIT_LIST_HEAD(&zdev->common.channels);
 
-	dma_set_mask(&pdev->dev, DMA_BIT_MASK(44));
+	if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(44)))
+		return -EIO;
 	dma_cap_set(DMA_MEMCPY, zdev->common.cap_mask);
 
 	p = &zdev->common;
-- 
2.17.1




More information about the linux-arm-kernel mailing list