From: Nathan Chancellor <nathan@kernel.org>
To: Simon Ser <contact@emersion.fr>
Cc: Souptick Joarder <jrdr.linux@gmail.com>,
harry.wentland@amd.com, sunpeng.li@amd.com,
alexander.deucher@amd.com, christian.koenig@amd.com,
airlied@linux.ie, daniel@ffwll.ch, nicholas.kazlauskas@amd.com,
Rodrigo.Siqueira@amd.com, aurabindo.pillai@amd.com,
stylon.wang@amd.com, bas@basnieuwenhuizen.nl,
Bhawanpreet.Lakha@amd.com, amd-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/amdgpu/display: initialize the variable 'i'
Date: Mon, 22 Feb 2021 16:44:57 -0700 [thread overview]
Message-ID: <20210222234457.GA36153@24bbad8f3778> (raw)
In-Reply-To: <32vjVDssCxltB75h5jHin2U3-cvNjmd_HFnRLiKohhbXkTfZea3hw2Knd80SgcHoyIFldMNwqh49t28hMBvta0HeWed1L0q_efLJ8QCgNw8=@emersion.fr>
On Mon, Feb 22, 2021 at 11:05:17PM +0000, Simon Ser wrote:
> On Monday, February 22nd, 2021 at 8:25 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>
> > >> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9804:38:
> > >> warning: variable 'i' is uninitialized when used here
> > >> [-Wuninitialized]
> > timing = &edid->detailed_timings[i];
> > ^
> > drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9714:7:
> > note: initialize the variable 'i' to silence this warning
> > int i;
> > ^
> > = 0
> > 1 warning generated.
> >
> > Initialize the variable 'i'.
>
> Hm, I see this variable already initialized in the loop:
>
> for (i = 0; i < 4; i++) {
>
> This is the branch agd5f/drm-next.
That is in the
if (amdgpu_dm_connector->dc_sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT
|| amdgpu_dm_connector->dc_sink->sink_signal == SIGNAL_TYPE_EDP) {
branch not the
} else if (edid && amdgpu_dm_connector->dc_sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A) {
branch, where i is indeed used uninitialized like clang complains about.
I am not at all familiar with the code so I cannot say if this fix is
the proper one but it is definitely a legitimate issue.
Cheers,
Nathan
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> > ---
> > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > index a22a53d..e96d3d9 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > @@ -9717,7 +9717,7 @@ static bool parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector,
> > void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
> > struct edid *edid)
> > {
> > - int i;
> > + int i = 0;
> > struct detailed_timing *timing;
> > struct detailed_non_pixel *data;
> > struct detailed_data_monitor_range *range;
> > --
> > 1.9.1
next prev parent reply other threads:[~2021-02-22 23:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-22 19:25 [PATCH] drm/amdgpu/display: initialize the variable 'i' Souptick Joarder
2021-02-22 23:05 ` Simon Ser
2021-02-22 23:44 ` Nathan Chancellor [this message]
2021-02-22 23:50 ` Simon Ser
2021-02-23 0:00 ` Nathan Chancellor
[not found] ` <CAP+8YyGdr0jkf5_K8ofKMzZn5Koy_vkxyKKHkyVDqDz2sWvL_g@mail.gmail.com>
2021-02-23 17:42 ` Alex Deucher
2021-02-23 17:44 ` Simon Ser
2021-02-23 17:46 ` Alex Deucher
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=20210222234457.GA36153@24bbad8f3778 \
--to=nathan@kernel.org \
--cc=Bhawanpreet.Lakha@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=bas@basnieuwenhuizen.nl \
--cc=christian.koenig@amd.com \
--cc=contact@emersion.fr \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=jrdr.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nicholas.kazlauskas@amd.com \
--cc=stylon.wang@amd.com \
--cc=sunpeng.li@amd.com \
/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