]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure
authorSwati Agarwal <swati.agarwal@xilinx.com>
Wed, 17 Aug 2022 06:11:25 +0000 (11:41 +0530)
committerVinod Koul <vkoul@kernel.org>
Sun, 4 Sep 2022 17:24:07 +0000 (22:54 +0530)
The driver does not handle the failure case while calling
dma_set_mask_and_coherent API.

In case of failure, capture the return value of API and then report an
error.

Addresses-coverity: Unchecked return value (CHECKED_RETURN)

Signed-off-by: Swati Agarwal <swati.agarwal@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Link: https://lore.kernel.org/r/20220817061125.4720-4-swati.agarwal@xilinx.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/xilinx/xilinx_dma.c

index 5e6e46437aea24dab5d9952bfbad5bb63e3ea0d4..8cd4e69dc7b4c24b334c450562c2a88925b0f452 100644 (file)
@@ -3091,7 +3091,11 @@ static int xilinx_dma_probe(struct platform_device *pdev)
                xdev->ext_addr = false;
 
        /* Set the dma mask bits */
-       dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width));
+       err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width));
+       if (err < 0) {
+               dev_err(xdev->dev, "DMA mask error %d\n", err);
+               goto disable_clks;
+       }
 
        /* Initialize the DMA engine */
        xdev->common.dev = &pdev->dev;