lkml.org 
[lkml]   [2023]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Intel-gfx] [PATCH] drm/i915/mtl: avoid stringop-overflow warning
On Tue, Oct 17, 2023, at 00:10, Andi Shyti wrote:
> Hi Arnd,
>
>> static void rc6_res_reg_init(struct intel_rc6 *rc6)
>> {
>> - memset(rc6->res_reg, INVALID_MMIO_REG.reg, sizeof(rc6->res_reg));
>
> This is a complex initialization, indeed... how about just
>
> memset(rc6->res_reg, 0, sizeof(rc6->res_reg));
>
>> + i915_reg_t res_reg[INTEL_RC6_RES_MAX] = {
>> + [0 ... INTEL_RC6_RES_MAX - 1] = INVALID_MMIO_REG,
>> + };
>
> This is basically a
>
> i915_reg_t res_reg[INTEL_RC6_RES_MAX] = { };
>
> Don't know which one is clearer.

Right, the original code went out of its way to use INVALID_MMIO_REG
instead of assuming it is zero, so I tried to preserve that for
consistency.

Arnd

\
 
 \ /
  Last update: 2023-10-17 07:29    [W:1.956 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site