All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] dmaengine: xilinx_dma: coverity fixes
@ 2020-12-17 18:10 Radhey Shyam Pandey
  2020-12-17 18:10 ` [PATCH 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-17 18:10 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek
  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.

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


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

* [PATCH 1/3] dmaengine: xilinx_dma: check dma_async_device_register return value
  2020-12-17 18:10 [PATCH 0/3] dmaengine: xilinx_dma: coverity fixes Radhey Shyam Pandey
@ 2020-12-17 18:10 ` Radhey Shyam Pandey
  2020-12-17 18:10 ` [PATCH 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-17 18:10 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek
  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.
Signed-off-by: Shravya Kumbham <shravya.kumbham@xilinx.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
 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 2/3] dmaengine: xilinx_dma: fix incompatible param warning in _child_probe()
  2020-12-17 18:10 [PATCH 0/3] dmaengine: xilinx_dma: coverity fixes Radhey Shyam Pandey
  2020-12-17 18:10 ` [PATCH 1/3] dmaengine: xilinx_dma: check dma_async_device_register return value Radhey Shyam Pandey
@ 2020-12-17 18:10 ` Radhey Shyam Pandey
  2020-12-17 18:10 ` [PATCH 3/3] dmaengine: xilinx_dma: fix mixed_enum_type coverity warning Radhey Shyam Pandey
  2020-12-21 14:29 ` [PATCH 0/3] dmaengine: xilinx_dma: coverity fixes Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Radhey Shyam Pandey @ 2020-12-17 18:10 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek
  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.
Signed-off-by: Shravya Kumbham <shravya.kumbham@xilinx.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
 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 3/3] dmaengine: xilinx_dma: fix mixed_enum_type coverity warning
  2020-12-17 18:10 [PATCH 0/3] dmaengine: xilinx_dma: coverity fixes Radhey Shyam Pandey
  2020-12-17 18:10 ` [PATCH 1/3] dmaengine: xilinx_dma: check dma_async_device_register return value Radhey Shyam Pandey
  2020-12-17 18:10 ` [PATCH 2/3] dmaengine: xilinx_dma: fix incompatible param warning in _child_probe() Radhey Shyam Pandey
@ 2020-12-17 18:10 ` Radhey Shyam Pandey
  2020-12-21 14:29 ` [PATCH 0/3] dmaengine: xilinx_dma: coverity fixes Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Radhey Shyam Pandey @ 2020-12-17 18:10 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek
  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.
Signed-off-by: Shravya Kumbham <shravya.kumbham@xilinx.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
 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


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

* Re: [PATCH 0/3] dmaengine: xilinx_dma: coverity fixes
  2020-12-17 18:10 [PATCH 0/3] dmaengine: xilinx_dma: coverity fixes Radhey Shyam Pandey
                   ` (2 preceding siblings ...)
  2020-12-17 18:10 ` [PATCH 3/3] dmaengine: xilinx_dma: fix mixed_enum_type coverity warning Radhey Shyam Pandey
@ 2020-12-21 14:29 ` Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2020-12-21 14:29 UTC (permalink / raw)
  To: Radhey Shyam Pandey
  Cc: dan.j.williams, michal.simek, dmaengine, linux-kernel, git

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

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

end of thread, other threads:[~2020-12-21 14:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 18:10 [PATCH 0/3] dmaengine: xilinx_dma: coverity fixes Radhey Shyam Pandey
2020-12-17 18:10 ` [PATCH 1/3] dmaengine: xilinx_dma: check dma_async_device_register return value Radhey Shyam Pandey
2020-12-17 18:10 ` [PATCH 2/3] dmaengine: xilinx_dma: fix incompatible param warning in _child_probe() Radhey Shyam Pandey
2020-12-17 18:10 ` [PATCH 3/3] dmaengine: xilinx_dma: fix mixed_enum_type coverity warning Radhey Shyam Pandey
2020-12-21 14:29 ` [PATCH 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.