diff mbox series

dmaengine: bcm2835-dma: Add check for dma_set_max_seg_size

Message ID 20240429041312.2150441-1-nichen@iscas.ac.cn (mailing list archive)
State New
Headers show
Series dmaengine: bcm2835-dma: Add check for dma_set_max_seg_size | expand

Commit Message

Chen Ni April 29, 2024, 4:13 a.m. UTC
Add check for the return value of dma_set_max_seg_size() and return
the error if it fails in order to catch the error.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/dma/bcm2835-dma.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig April 29, 2024, 4:37 a.m. UTC | #1
On Mon, Apr 29, 2024 at 12:13:12PM +0800, Chen Ni wrote:
> Add check for the return value of dma_set_max_seg_size() and return
> the error if it fails in order to catch the error.

Ok. this looks like you're looking t all dma_set_max_seg_size callers?
If so mybe just work on removing the return value instead..
diff mbox series

Patch

diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
index 9d74fe97452e..d1e775a2f6b3 100644
--- a/drivers/dma/bcm2835-dma.c
+++ b/drivers/dma/bcm2835-dma.c
@@ -899,7 +899,11 @@  static int bcm2835_dma_probe(struct platform_device *pdev)
 	if (!od)
 		return -ENOMEM;
 
-	dma_set_max_seg_size(&pdev->dev, 0x3FFFFFFF);
+	rc = dma_set_max_seg_size(&pdev->dev, 0x3FFFFFFF);
+	if (rc) {
+		dev_err(&pdev->dev, "Unable to set dma device segment size\n");
+		return rc;
+	}
 
 	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base))