lkml.org 
[lkml]   [2022]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/6] fpga: zynqmp: Initialized variables before using it
On Tue, Mar 08, 2022 at 03:15:15PM +0530, Nava kishore Manne wrote:
> This patch initialized variables with the proper value.
> Addresses-Coverity: "uninit_use: Using uninitialized value"
>
> Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com>
> ---
> drivers/fpga/zynqmp-fpga.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c
> index c60f20949c47..e931d69819a7 100644
> --- a/drivers/fpga/zynqmp-fpga.c
> +++ b/drivers/fpga/zynqmp-fpga.c
> @@ -41,7 +41,7 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,
> const char *buf, size_t size)
> {
> struct zynqmp_fpga_priv *priv;
> - dma_addr_t dma_addr;
> + dma_addr_t dma_addr = 0;

The first use of this variable is as an output parameter:

kbuf = dma_alloc_coherent(priv->dev, size, &dma_addr, GFP_KERNEL);

So I don't think it needs to be initialized as 0.

Thanks,
Yilun

> u32 eemi_flags = 0;
> char *kbuf;
> int ret;
> --
> 2.25.1

\
 
 \ /
  Last update: 2022-03-11 15:36    [W:0.172 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site