[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220308084424.GC26648@pengutronix.de>
Date: Tue, 8 Mar 2022 09:44:24 +0100
From: Michael Tretter <m.tretter@...gutronix.de>
To: Jia-Ju Bai <baijiaju1990@...il.com>
Cc: vkoul@...nel.org, michal.simek@...inx.com, lars@...afoo.de,
libaokun1@...wei.com, yukuai3@...wei.com,
dmaengine@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] dma: xilinx: check the return value of dma_set_mask()
in zynqmp_dma_probe()
On Sat, 05 Mar 2022 01:31:20 -0800, Jia-Ju Bai wrote:
> 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@...nghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
Reviewed-by: Michael Tretter <m.tretter@...gutronix.de>
> ---
> v2:
> * Print an error message and forward the return value of dma_set_mask().
> Thank Michael for good advice.
>
> ---
> drivers/dma/xilinx/zynqmp_dma.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index 7aa63b652027..2791e9c6a4ea 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -1050,7 +1050,10 @@ 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));
> + ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(44));
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret, "No usable DMA available\n");
> +
> dma_cap_set(DMA_MEMCPY, zdev->common.cap_mask);
>
> p = &zdev->common;
> --
> 2.17.1
>
>
Powered by blists - more mailing lists