[PATCH] dmaengine: dw-axi-dmac: Add check for dma_set_max_seg_size in dw_probe()

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

Fixes: 78a90a1e489e ("dmaengine: dw-axi-dmac: Set constraint to the Max segment size")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
 drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index fffafa86d964..689667e10928 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -1579,7 +1579,10 @@ static int dw_probe(struct platform_device *pdev)
 	 * Therefore, set constraint to 1024 * 4.
 	 */
 	dw->dma.dev->dma_parms = &dw->dma_parms;
-	dma_set_max_seg_size(&pdev->dev, MAX_BLOCK_SIZE);
+	ret = dma_set_max_seg_size(&pdev->dev, MAX_BLOCK_SIZE);
+	if (ret)
+		return ret;
+
 	platform_set_drvdata(pdev, chip);
 
 	pm_runtime_enable(chip->dev);
-- 
2.25.1
Re: [PATCH] dmaengine: dw-axi-dmac: Add check for dma_set_max_seg_size in dw_probe()
Posted by Markus Elfring 1 year, 5 months ago
> As the possible failure of the dma_set_max_seg_size(), we should better
> check the return value of the dma_set_max_seg_size().

Please avoid the repetition of a function name in such a change description.
Can it be improved with corresponding imperative wordings?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc5#n94

Regards,
Markus