[PATCH] dmaengine: axi-dmac: Add check for dma_set_max_seg_size

Ma Ke posted 1 patch 1 year, 5 months ago
drivers/dma/dma-axi-dmac.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] dmaengine: axi-dmac: Add check for dma_set_max_seg_size
Posted by Ma Ke 1 year, 5 months ago
To avoid possible failure of the dma_set_max_seg_size(), we should
better check the return value of the dma_set_max_seg_size().

Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
 drivers/dma/dma-axi-dmac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
index bdb752f11869..93543c2f1bd7 100644
--- a/drivers/dma/dma-axi-dmac.c
+++ b/drivers/dma/dma-axi-dmac.c
@@ -1051,7 +1051,9 @@ static int axi_dmac_probe(struct platform_device *pdev)
 
 	INIT_LIST_HEAD(&dmac->chan.active_descs);
 
-	dma_set_max_seg_size(&pdev->dev, UINT_MAX);
+	ret = dma_set_max_seg_size(&pdev->dev, UINT_MAX);
+	if (ret)
+		return ret;
 
 	dma_dev = &dmac->dma_dev;
 	dma_cap_set(DMA_SLAVE, dma_dev->cap_mask);
-- 
2.25.1
Re: [PATCH] dmaengine: axi-dmac: Add check for dma_set_max_seg_size
Posted by Markus Elfring 1 year, 5 months ago
> To avoid possible failure of the dma_set_max_seg_size(),

Really?

It is desirable to detect a failed function call, isn't it?


> we should better check the return value of the dma_set_max_seg_size().

1. Please choose an imperative wording for an improved change description.
   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc4#n94

2. Would you like to add any tags (like “Fixes” and “Cc”) accordingly?

3. How do you think about to append the text “() in axi_dmac_probe()”
   to the summary phrase?


Regards,
Markus