drm: panel: himax-hx8279: avoid using an uninitialized variable
Subsystems (3)
PATCH 1/1 drm: panel: himax-hx8279: avoid using an uninitialized variable
From: Arnd Bergmann <[email protected]>
goa_even_valid is only initialized in one branch but not the other:
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)
| ^~~~~~~~~~~~~~Change the initialization to set it to the value of the condition instead.
--- drivers/gpu/drm/panel/panel-himax-hx8279.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-himax-hx8279.c +1 -2
@@ -835,8 +835,7 @@ static int hx8279_check_goa_config(struct hx8279 *hx, struct device *dev) num_zero++; } -if (num_zero ==ARRAY_SIZE (desc->goa_even_timing)) - goa_even_valid = false; + goa_even_valid = (num_zero !=ARRAY_SIZE (desc->goa_even_timing));/* Programming one without the other would make no sense! */ if (goa_odd_valid != goa_even_valid)
Signature · 1 line
2.39.5
Quoted 11 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
goa_even_validis only initialized in one branch but not the other:
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) | ^~~~~~~~~~~~~~
Quoted 8 lines
Change the initialization to set it to the value of the condition instead.
Fixes 38d42c261389 ("drm: panel: Add driver for Himax HX8279 DDIC panels")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/gpu/drm/panel/panel-himax-hx8279.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 1 line
Signature · 2 lines
With best wishes Dmitry
Il 23/04/25 18:32, Arnd Bergmann ha scritto:
Quoted 11 lines
From: Arnd Bergmann <[email protected]>
goa_even_validis only initialized in one branch but not the other:
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) | ^~~~~~~~~~~~~~
Quoted 4 lines
Change the initialization to set it to the value of the condition instead.
Fixes 38d42c261389 ("drm: panel: Add driver for Himax HX8279 DDIC panels")Signed-off-by Arnd Bergmann <[email protected]>
Quoted 18 lines
--- drivers/gpu/drm/panel/panel-himax-hx8279.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/panel/panel-himax-hx8279.c +1
-2@@ -835,8 +835,7 @@ static int hx8279_check_goa_config(struct hx8279 *hx, struct device *dev) num_zero++; } -if (num_zero ==ARRAY_SIZE (desc->goa_even_timing)) - goa_even_valid = false; + goa_even_valid = (num_zero !=ARRAY_SIZE (desc->goa_even_timing));/* Programming one without the other would make no sense! */ if (goa_odd_valid != goa_even_valid)
Neil Armstrong
maintainerHi,
Quoted 24 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
goa_even_validis only initialized in one branch but not the other:
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) | ^~~~~~~~~~~~~~Change the initialization to set it to the value of the condition instead.
Fixes 38d42c261389 ("drm: panel: Add driver for Himax HX8279 DDIC panels")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/gpu/drm/panel/panel-himax-hx8279.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/panel/panel-himax-hx8279.c +0
-0
drivers/gpu/drm/panel/panel-himax-hx8279.c static int hx8279_check_goa_config(struct hx8279 *hx, struct device *dev) · line 841
Quoted 9 lines
drivers/gpu/drm/panel/panel-himax-hx8279.c +1
-2@@ -835,8 +835,7 @@ static int hx8279_check_goa_config(struct hx8279 *hx, struct device *dev) num_zero++; } -if (num_zero ==ARRAY_SIZE (desc->goa_even_timing)) - goa_even_valid = false; + goa_even_valid = (num_zero !=ARRAY_SIZE (desc->goa_even_timing));/* Programming one without the other would make no sense! */ if (goa_odd_valid != goa_even_valid)
Thanks, Applying https://lore.kernel.org/all/20250423-panel-himax-hx8279-fix-sometimes-uninitialized-v2-1-fc501c6558d9@kernel.org/
instead since more complete.
Neil