All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes
@ 2020-12-23 11:20 Radhey Shyam Pandey
  2020-12-23 11:21 ` [PATCH v2 1/3] dmaengine: xilinx_dma: check dma_async_device_register return value Radhey Shyam Pandey
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Radhey Shyam Pandey @ 2020-12-23 11:20 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek, nick.graumann,
	andrea.merello, appana.durga.rao, mcgrof
  Cc: dmaengine, linux-kernel, git, Radhey Shyam Pandey

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/3] dmaengine: xilinx_dma: check dma_async_device_register return value
  2020-12-23 11:20 [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes Radhey Shyam Pandey
@ 2020-12-23 11:21 ` Radhey Shyam Pandey
  2020-12-23 11:21 ` [PATCH v2 2/3] dmaengine: xilinx_dma: fix incompatible param warning in _child_probe() Radhey Shyam Pandey
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Radhey Shyam Pandey @ 2020-12-23 11:21 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek, nick.graumann,
	andrea.merello, appana.durga.rao, mcgrof
  Cc: dmaengine, linux-kernel, git, Shravya Kumbham, Radhey Shyam Pandey

From: Shravya Kumbham <shravya.kumbham@xilinx.com>

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 <shravya.kumbham@xilinx.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/3] dmaengine: xilinx_dma: fix incompatible param warning in _child_probe()
  2020-12-23 11:20 [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes Radhey Shyam Pandey
  2020-12-23 11:21 ` [PATCH v2 1/3] dmaengine: xilinx_dma: check dma_async_device_register return value Radhey Shyam Pandey
@ 2020-12-23 11:21 ` Radhey Shyam Pandey
  2020-12-23 11:21 ` [PATCH v2 3/3] dmaengine: xilinx_dma: fix mixed_enum_type coverity warning Radhey Shyam Pandey
  2021-01-04 12:42 ` [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Radhey Shyam Pandey @ 2020-12-23 11:21 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek, nick.graumann,
	andrea.merello, appana.durga.rao, mcgrof
  Cc: dmaengine, linux-kernel, git, Shravya Kumbham, Radhey Shyam Pandey

From: Shravya Kumbham <shravya.kumbham@xilinx.com>

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 <shravya.kumbham@xilinx.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 3/3] dmaengine: xilinx_dma: fix mixed_enum_type coverity warning
  2020-12-23 11:20 [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes Radhey Shyam Pandey
  2020-12-23 11:21 ` [PATCH v2 1/3] dmaengine: xilinx_dma: check dma_async_device_register return value Radhey Shyam Pandey
  2020-12-23 11:21 ` [PATCH v2 2/3] dmaengine: xilinx_dma: fix incompatible param warning in _child_probe() Radhey Shyam Pandey
@ 2020-12-23 11:21 ` Radhey Shyam Pandey
  2021-01-04 12:42 ` [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Radhey Shyam Pandey @ 2020-12-23 11:21 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek, nick.graumann,
	andrea.merello, appana.durga.rao, mcgrof
  Cc: dmaengine, linux-kernel, git, Shravya Kumbham, Radhey Shyam Pandey

From: Shravya Kumbham <shravya.kumbham@xilinx.com>

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 <shravya.kumbham@xilinx.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes
  2020-12-23 11:20 [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes Radhey Shyam Pandey
                   ` (2 preceding siblings ...)
  2020-12-23 11:21 ` [PATCH v2 3/3] dmaengine: xilinx_dma: fix mixed_enum_type coverity warning Radhey Shyam Pandey
@ 2021-01-04 12:42 ` Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2021-01-04 12:42 UTC (permalink / raw)
  To: Radhey Shyam Pandey
  Cc: dan.j.williams, michal.simek, nick.graumann, andrea.merello,
	appana.durga.rao, mcgrof, dmaengine, linux-kernel, git

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-04 12:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-23 11:20 [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes Radhey Shyam Pandey
2020-12-23 11:21 ` [PATCH v2 1/3] dmaengine: xilinx_dma: check dma_async_device_register return value Radhey Shyam Pandey
2020-12-23 11:21 ` [PATCH v2 2/3] dmaengine: xilinx_dma: fix incompatible param warning in _child_probe() Radhey Shyam Pandey
2020-12-23 11:21 ` [PATCH v2 3/3] dmaengine: xilinx_dma: fix mixed_enum_type coverity warning Radhey Shyam Pandey
2021-01-04 12:42 ` [PATCH v2 0/3] dmaengine: xilinx_dma: coverity fixes Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.