2021-09-14 08:31:16

by Harini Katakam

[permalink] [raw]
Subject: [PATCH 4/4] dmaengine: zynqmp_dma: Typecast with enum to fix the coverity warning

From: Shravya Kumbham <[email protected]>

Typecast the flags variable with (enum dma_ctrl_flags) in
zynqmp_dma_prep_memcpy function to fix the coverity warning.

Addresses-Coverity: Event mixed_enum_type.
Signed-off-by: Shravya Kumbham <[email protected]>
Reviewed-by: Radhey Shyam Pandey <[email protected]>
---
drivers/dma/xilinx/zynqmp_dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index 588460e56ab8..282d01ab402f 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -849,7 +849,7 @@ static struct dma_async_tx_descriptor *zynqmp_dma_prep_memcpy(

zynqmp_dma_desc_config_eod(chan, desc);
async_tx_ack(&first->async_tx);
- first->async_tx.flags = flags;
+ first->async_tx.flags = (enum dma_ctrl_flags)flags;
return &first->async_tx;
}

--
2.17.1


2021-09-23 14:19:48

by Michael Tretter

[permalink] [raw]
Subject: Re: [PATCH 4/4] dmaengine: zynqmp_dma: Typecast with enum to fix the coverity warning

On Tue, 14 Sep 2021 13:58:17 +0530, Harini Katakam wrote:
> From: Shravya Kumbham <[email protected]>
>
> Typecast the flags variable with (enum dma_ctrl_flags) in
> zynqmp_dma_prep_memcpy function to fix the coverity warning.
>
> Addresses-Coverity: Event mixed_enum_type.
> Signed-off-by: Shravya Kumbham <[email protected]>
> Reviewed-by: Radhey Shyam Pandey <[email protected]>
> ---
> drivers/dma/xilinx/zynqmp_dma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index 588460e56ab8..282d01ab402f 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -849,7 +849,7 @@ static struct dma_async_tx_descriptor *zynqmp_dma_prep_memcpy(
>
> zynqmp_dma_desc_config_eod(chan, desc);
> async_tx_ack(&first->async_tx);
> - first->async_tx.flags = flags;
> + first->async_tx.flags = (enum dma_ctrl_flags)flags;

Thanks for the patch.

I looked at a few dmaengine drivers, at it looks like all of them have this
issue. Maybe we should change the signature of the dmaengine_prep_dma_memcpy()
engine to accept "enum dma_ctrl_flags flags" instead of "unsigned long flags"?

Michael

> return &first->async_tx;
> }
>
> --
> 2.17.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>