Il 23/04/25 19:41, Nathan Chancellor ha scritto:
Clang warns (or errors with CONFIG_WERROR=y):

   drivers/gpu/drm/panel/panel-himax-hx8279.c:838:6: error: variable 
'goa_even_valid' is used uninitialized whenever 'if' condition is false 
[-Werror,-Wsometimes-uninitialized]
     838 |         if (num_zero == ARRAY_SIZE(desc->goa_even_timing))
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/panel/panel-himax-hx8279.c:842:23: note: uninitialized use 
occurs here
     842 |         if (goa_odd_valid != goa_even_valid)
         |                              ^~~~~~~~~~~~~~
   drivers/gpu/drm/panel/panel-himax-hx8279.c:838:2: note: remove the 'if' if 
its condition is always true
     838 |         if (num_zero == ARRAY_SIZE(desc->goa_even_timing))
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     839 |                 goa_even_valid = false;
   drivers/gpu/drm/panel/panel-himax-hx8279.c:818:36: note: initialize the 
variable 'goa_even_valid' to silence this warning
     818 |         bool goa_odd_valid, goa_even_valid;
         |                                           ^
         |                                            = 0

Even though only the even valid variable gets flagged, both valid
variables appear to have the same issue of possibly being used
uninitialized if the if statement initializing them to false is not
taken.

Turn the if statement then variable assignment into a single variable
assignment, which states that the configuration is valid when there are
not all zeros, clearing up the warning since the variable will always be
initialized.

Fixes: 38d42c261389 ("drm: panel: Add driver for Himax HX8279 DDIC panels")
Suggested-by: AngeloGioacchino Del Regno 
<[email protected]>
Reviewed-by: AngeloGioacchino Del Regno 
<[email protected]>
Signed-off-by: Nathan Chancellor <[email protected]>

Actually, I prefer this one, as Arnd's commit fixes only one of the two, but 
this
initializes both :-)

Cheers,
Angelo

Reply via email to