2024-04-29 04:14:10

by Chen Ni

[permalink] [raw]
Subject: [PATCH] dmaengine: bcm2835-dma: Add check for dma_set_max_seg_size

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 <[email protected]>
---
drivers/dma/bcm2835-dma.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

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))
--
2.25.1



2024-04-29 06:41:41

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] dmaengine: bcm2835-dma: Add check for dma_set_max_seg_size

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..