2020-12-17 18:15:26

by Radhey Shyam Pandey

[permalink] [raw]
Subject: [PATCH 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.

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 | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

--
2.7.4


2020-12-17 18:15:30

by Radhey Shyam Pandey

[permalink] [raw]
Subject: [PATCH 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.
Signed-off-by: Shravya Kumbham <[email protected]>
Signed-off-by: Radhey Shyam Pandey <[email protected]>
---
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-17 18:16:00

by Radhey Shyam Pandey

[permalink] [raw]
Subject: [PATCH 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.
Signed-off-by: Shravya Kumbham <[email protected]>
Signed-off-by: Radhey Shyam Pandey <[email protected]>
---
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 cf75e2af6381..5e6dcb72a888 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -2801,7 +2801,8 @@ 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

2020-12-17 18:16:12

by Radhey Shyam Pandey

[permalink] [raw]
Subject: [PATCH 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.
Signed-off-by: Shravya Kumbham <[email protected]>
Signed-off-by: Radhey Shyam Pandey <[email protected]>
---
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-21 14:31:28

by Vinod Koul

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

On 17-12-20, 23:40, 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.

Looks good, can you please add fixes tag and make it one line in last
patch (I think it would fit now)

--
~Vinod