dmaengine: mxs-dma: Add check for dma_set_max_seg_size in mxs_dma_probe()
Subsystems (2)
PATCH 1/1 dmaengine: mxs-dma: Add check for dma_set_max_seg_size in mxs_dma_probe()
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().
--- drivers/dma/mxs-dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/mxs-dma.c +3 -1
@@ -798,7 +798,9 @@ static int mxs_dma_probe(struct platform_device *pdev) mxs_dma->dma_device.dev = &pdev->dev;/* mxs_dma gets 65535 bytes maximum sg size */ -dma_set_max_seg_size (mxs_dma->dma_device.dev,MAX_XFER_BYTES ); + ret =dma_set_max_seg_size (mxs_dma->dma_device.dev,MAX_XFER_BYTES ); +if (ret) +return ret; mxs_dma->dma_device.device_alloc_chan_resources = mxs_dma_alloc_chan_resources; mxs_dma->dma_device.device_free_chan_resources = mxs_dma_free_chan_resources;
Signature · 1 line
2.25.1
Quoted 2 lines
Subject: [PATCH] dmaengine: mxs-dma: Add check for
dma_set_max_seg_sizeinmxs_dma_probe()
Please read
https://lore.kernel.org/all/ZiocjS6tbeTt2mPD@matsya/
Regards,
Peng.
Quoted 34 lines
As the possible failure of the
dma_set_max_seg_size(), we should better check the return value of thedma_set_max_seg_size().Fixes a580b8c5429a ("dmaengine: mxs-dma: add dma support fori.MX23/28")
Signed-off-by Ma Ke <[email protected]>--- drivers/dma/mxs-dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/dma/mxs-dma.c index renamed from drivers/dma/mxs-dma.c +0
-0
cfb9962417ef..90cbb9b04b02100644drivers/dma/mxs-dma.c +3
-1@@ -798,7 +798,9 @@ static int mxs_dma_probe(struct platform_device *pdev) mxs_dma->dma_device.dev = &pdev->dev;/* mxs_dma gets 65535 bytes maximum sg size */ -dma_set_max_seg_size (mxs_dma->dma_device.dev, MAX_XFER_BYTES); + ret =dma_set_max_seg_size (mxs_dma->dma_device.dev,MAX_XFER_BYTES ); +if (ret) +return ret;
mxs_dma->dma_device.device_alloc_chan_resources=mxs_dma_alloc_chan_resources;
mxs_dma->dma_device.device_free_chan_resources=mxs_dma_free_chan_resources;
--
2.25.1
Hi
Quoted 29 lines · Peng Fan
Quoted 3 lines
Subject: [PATCH] dmaengine: mxs-dma: Add check for
dma_set_max_seg_sizeinmxs_dma_probe()Please read
https://lore.kernel.org/all/ZiocjS6tbeTt2mPD@matsya/Regards,
Peng.Quoted 19 lines
As the possible failure of the
dma_set_max_seg_size(), we should better check the return value of thedma_set_max_seg_size().Fixes a580b8c5429a ("dmaengine: mxs-dma: add dma support fori.MX23/28")
Signed-off-by Ma Ke <[email protected]>--- drivers/dma/mxs-dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/dma/mxs-dma.c index renamed from drivers/dma/mxs-dma.c +0
-0
cfb9962417ef..90cbb9b04b02100644drivers/dma/mxs-dma.c +0
-0@@ -798,7 +798,9 @@ static int mxs_dma_probe(struct platform_device *pdev) mxs_dma->dma_device.dev = &pdev->dev;
Quoted 8 lines
drivers/dma/mxs-dma.c static int mxs_dma_probe(struct · line 806
Quoted 8 lines
drivers/dma/mxs-dma.c +3
-1/* mxs_dma gets 65535 bytes maximum sg size */ -dma_set_max_seg_size (mxs_dma->dma_device.dev, MAX_XFER_BYTES); + ret =dma_set_max_seg_size (mxs_dma->dma_device.dev,MAX_XFER_BYTES ); +if (ret) +return ret;
If the function returns an error then you should check for it. If it's not logical to have it, then you could
make void the function that is called and WARN_ON on an illogical situation
Michael
Quoted 9 lines
Quoted 7 lines
mxs_dma->dma_device.device_alloc_chan_resources = mxs_dma_alloc_chan_resources; mxs_dma->dma_device.device_free_chan_resources =
mxs_dma_free_chan_resources;
--
2.25.1
Quoted 2 lines
As the possible failure of the
dma_set_max_seg_size(), we should better check the return value of thedma_set_max_seg_size().
Please avoid the repetition of a function name in such a change description. Can it be improved with a corresponding imperative wording?
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