2020-12-23 11:22:53

by Radhey Shyam Pandey

[permalink] [raw]
Subject: [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes

This patch series fix coverity warnings for xilinx_dma driver.
No functional change. These patches are picked from xilinx
linux tree and posted for upstream.

Changes for v2:
- Include fixes tag.
- In 3/3 patch keep typecasting changes in the same line.

Shravya Kumbham (3):
dmaengine: xilinx_dma: check dma_async_device_register return value
dmaengine: xilinx_dma: fix incompatible param warning in
_child_probe()
dmaengine: xilinx_dma: fix mixed_enum_type coverity warning

drivers/dma/xilinx/xilinx_dma.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

--
2.7.4


2020-12-23 11:23:31

by Radhey Shyam Pandey

[permalink] [raw]
Subject: [PATCH v2 1/3] dmaengine: xilinx_dma: check dma_async_device_register return value

From: Shravya Kumbham <[email protected]>

dma_async_device_register() can return non-zero error code. Add
condition to check the return value of dma_async_device_register
function and handle the error path.

Addresses-Coverity: Event check_return.
Fixes: 9cd4360de609 ("dma: Add Xilinx AXI Video Direct Memory Access Engine driver support")
Signed-off-by: Shravya Kumbham <[email protected]>
Signed-off-by: Radhey Shyam Pandey <[email protected]>
---
Changes for v2:
- Include fixes tag.
---
drivers/dma/xilinx/xilinx_dma.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index 993297d585c0..e41435be5b79 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -3133,7 +3133,11 @@ static int xilinx_dma_probe(struct platform_device *pdev)
}

/* Register the DMA engine with the core */
- dma_async_device_register(&xdev->common);
+ err = dma_async_device_register(&xdev->common);
+ if (err) {
+ dev_err(xdev->dev, "failed to register the dma device\n");
+ goto error;
+ }

err = of_dma_controller_register(node, of_dma_xilinx_xlate,
xdev);
--
2.7.4

2020-12-23 11:24:32

by Radhey Shyam Pandey

[permalink] [raw]
Subject: [PATCH v2 2/3] dmaengine: xilinx_dma: fix incompatible param warning in _child_probe()

From: Shravya Kumbham <[email protected]>

In xilinx_dma_child_probe function, the nr_channels variable is
passed to of_property_read_u32() which expects an u32 return value
pointer. Modify the nr_channels variable type from int to u32 to
fix the incompatible parameter coverity warning.

Addresses-Coverity: Event incompatible_param.
Fixes: 1a9e7a03c761 ("dmaengine: vdma: Add support for mulit-channel dma mode")
Signed-off-by: Shravya Kumbham <[email protected]>
Signed-off-by: Radhey Shyam Pandey <[email protected]>
---
Changes for v2:
- Include fixes tag.
---
drivers/dma/xilinx/xilinx_dma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index e41435be5b79..cf75e2af6381 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -2921,7 +2921,8 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
static int xilinx_dma_child_probe(struct xilinx_dma_device *xdev,
struct device_node *node)
{
- int ret, i, nr_channels = 1;
+ int ret, i;
+ u32 nr_channels = 1;

ret = of_property_read_u32(node, "dma-channels", &nr_channels);
if (xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA && ret < 0)
--
2.7.4

2020-12-23 11:25:08

by Radhey Shyam Pandey

[permalink] [raw]
Subject: [PATCH v2 3/3] dmaengine: xilinx_dma: fix mixed_enum_type coverity warning

From: Shravya Kumbham <[email protected]>

Typecast the fls(width -1) with (enum dmaengine_alignment) in
xilinx_dma_chan_probe function to fix the coverity warning.

Addresses-Coverity: Event mixed_enum_type.
Fixes: 9cd4360de609 ("dma: Add Xilinx AXI Video Direct Memory Access Engine driver support")
Signed-off-by: Shravya Kumbham <[email protected]>
Signed-off-by: Radhey Shyam Pandey <[email protected]>
---
Changes for v2:
- Include fixes tag.
- Keep typecasting changes in the same line to increase readability.
---
drivers/dma/xilinx/xilinx_dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index cf75e2af6381..7639fd07e280 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -2801,7 +2801,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
has_dre = false;

if (!has_dre)
- xdev->common.copy_align = fls(width - 1);
+ xdev->common.copy_align = (enum dmaengine_alignment)fls(width - 1);

if (of_device_is_compatible(node, "xlnx,axi-vdma-mm2s-channel") ||
of_device_is_compatible(node, "xlnx,axi-dma-mm2s-channel") ||
--
2.7.4

2021-01-04 12:46:05

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes

On 23-12-20, 16:50, Radhey Shyam Pandey wrote:
> This patch series fix coverity warnings for xilinx_dma driver.
> No functional change. These patches are picked from xilinx
> linux tree and posted for upstream.

Applied, thanks

--
~Vinod