From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Nathan Chancellor <nathan@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jessica Zhang <quic_jesszhan@quicinc.com>,
dri-devel@lists.freedesktop.org, llvm@lists.linux.dev,
patches@lists.linux.dev
Subject: Re: [PATCH v2] drm/panel: himax-hx8279: Always initialize goa_{even,odd}_valid in hx8279_check_goa_config()
Date: Thu, 24 Apr 2025 09:23:11 +0200 [thread overview]
Message-ID: <78d3095e-0cfd-4589-ada6-35569e01bc20@collabora.com> (raw)
In-Reply-To: <20250423-panel-himax-hx8279-fix-sometimes-uninitialized-v2-1-fc501c6558d9@kernel.org>
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 <angelogioacchino.delregno@collabora.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Actually, I prefer this one, as Arnd's commit fixes only one of the two, but this
initializes both :-)
Cheers,
Angelo
next prev parent reply other threads:[~2025-04-24 7:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 17:41 [PATCH v2] drm/panel: himax-hx8279: Always initialize goa_{even,odd}_valid in hx8279_check_goa_config() Nathan Chancellor
2025-04-24 7:23 ` AngeloGioacchino Del Regno [this message]
2025-04-24 7:35 ` Neil Armstrong
2025-04-24 8:22 ` Neil Armstrong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=78d3095e-0cfd-4589-ada6-35569e01bc20@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=llvm@lists.linux.dev \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=nathan@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=patches@lists.linux.dev \
--cc=quic_jesszhan@quicinc.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox