[PATCH] drm/xe: Ensure 'passed' variable is always initialized

Matthew Brost matthew.brost at intel.com
Mon Dec 18 20:29:21 UTC 2023


On Mon, Dec 18, 2023 at 11:38:18AM -0500, Rodrigo Vivi wrote:
> Although the path should be impossible, some static analyzers
> and compilers might not like the fact that there is a path
> where 'passed' variable is not initialized.
> 
> Reported-by: kernel test robot <lkp at intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202312170357.KPSinwPs-lkp@intel.com/
> Fixes: ad7d86415578 ("drm/xe: Enable W=1 warnings by default")
> Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_wait_user_fence.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_wait_user_fence.c b/drivers/gpu/drm/xe/xe_wait_user_fence.c
> index b0a7896f7fcb6..b2e76331bfa73 100644
> --- a/drivers/gpu/drm/xe/xe_wait_user_fence.c
> +++ b/drivers/gpu/drm/xe/xe_wait_user_fence.c
> @@ -19,7 +19,7 @@ static int do_compare(u64 addr, u64 value, u64 mask, u16 op)
>  {
>  	u64 rvalue;
>  	int err;
> -	bool passed;
> +	bool passed = 0;
>  
>  	err = copy_from_user(&rvalue, u64_to_user_ptr(addr), sizeof(rvalue));
>  	if (err)
> -- 
> 2.43.0
> 


More information about the Intel-xe mailing list