[Intel-xe] [PATCH 2/3] drm/i915: Fix uninitialized variable warning

Jani Nikula jani.nikula at linux.intel.com
Tue Oct 24 10:50:21 UTC 2023


On Wed, 18 Oct 2023, Michał Winiarski <michal.winiarski at intel.com> wrote:
> When used with Xe, "val" uses as function argument name clashes with
> "val" used inside iosys_map_* macro causing the build to fail with:
>
> drivers/gpu/drm/i915/display/intel_dsb.c:87:46: error: variable 'val' is uninitialized when used within its own initialization [-Werror,-Wuninitialized]

Whatever the outcome of the discussion, this patch must *not* be applied
to drm-xe-next. It needs to go to upstream i915 first.

BR,
Jani.

>
> Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dsb.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c
> index 796b1b36dc598..8d89c8f700d68 100644
> --- a/drivers/gpu/drm/i915/display/intel_dsb.c
> +++ b/drivers/gpu/drm/i915/display/intel_dsb.c
> @@ -79,12 +79,12 @@ static u32 dsb_ggtt_offset(struct intel_dsb *dsb)
>  #endif
>  }
>  
> -static void dsb_write(struct intel_dsb *dsb, u32 idx, u32 val)
> +static void dsb_write(struct intel_dsb *dsb, u32 idx, u32 value)
>  {
>  #ifdef I915
> -	dsb->cmd_buf[idx] = val;
> +	dsb->cmd_buf[idx] = value;
>  #else
> -	iosys_map_wr(&dsb->obj->vmap, idx * 4, u32, val);
> +	iosys_map_wr(&dsb->obj->vmap, idx * 4, u32, value);
>  #endif
>  }
>  
> @@ -97,12 +97,12 @@ static u32 dsb_read(struct intel_dsb *dsb, u32 idx)
>  #endif
>  }
>  
> -static void dsb_memset(struct intel_dsb *dsb, u32 idx, u32 val, u32 sz)
> +static void dsb_memset(struct intel_dsb *dsb, u32 idx, u32 value, u32 sz)
>  {
>  #ifdef I915
> -	memset(&dsb->cmd_buf[idx], val, sz);
> +	memset(&dsb->cmd_buf[idx], value, sz);
>  #else
> -	iosys_map_memset(&dsb->obj->vmap, idx * 4, val, sz);
> +	iosys_map_memset(&dsb->obj->vmap, idx * 4, value, sz);
>  #endif
>  }

-- 
Jani Nikula, Intel


More information about the Intel-xe mailing list