From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Kahola, Mika" <mika.kahola@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: RE: [PATCH] drm/i915/display: Initialize phy and ch variables
Date: Wed, 03 Sep 2025 15:40:57 +0300 [thread overview]
Message-ID: <8a7129a9d1954dfbf0a3963d982fabe9feda7659@intel.com> (raw)
In-Reply-To: <DS4PPF69154114F895D5FD0289E7008DC83EF01A@DS4PPF69154114F.namprd11.prod.outlook.com>
On Wed, 03 Sep 2025, "Kahola, Mika" <mika.kahola@intel.com> wrote:
> Ok good to know. Let's just ignore this patch.
That said, all places that use bxt_port_to_phy_channel(),
vlv_dig_port_to_channel(), vlv_dig_port_to_phy(), vlv_pipe_to_channel(),
or vlv_pipe_to_phy() need *both* the phy and channel.
So I'm thinking you could add
struct {
enum dpio_phy phy;
enum dpio_channel channel;
} dpio_phy_channel;
and convert the above functions to always return that struct. It's small
enough to return as a whole. Something like:
struct dpio_phy_channel phy_channel;
phy_channel = bxt_port_to_phy_channel(display, port);
and
phy_channel = vlv_dig_port_to_phy_channel(dig_port);
and
phy_channel = vlv_pipe_to_phy_channel(pipe);
Then you can also do s/phy/phy_channel.phy/ and s/ch/phy_channel.ch/ as
cleanup (if it actually cleans things up, maybe not).
Bonus points if you can come up with a better name than
"phy_channel". ;)
With that, the interface gets reduced for vlv, and it's obvious to
static analyzers the stuff gets initialized. Win-win?
BR,
Jani.
>
> Thanks!
>
> -Mika-
>
>> -----Original Message-----
>> From: Jani Nikula <jani.nikula@linux.intel.com>
>> Sent: Wednesday, 3 September 2025 15.19
>> To: Kahola, Mika <mika.kahola@intel.com>; intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
>> Cc: Kahola, Mika <mika.kahola@intel.com>
>> Subject: Re: [PATCH] drm/i915/display: Initialize phy and ch variables
>>
>> On Wed, 03 Sep 2025, Mika Kahola <mika.kahola@intel.com> wrote:
>> > phy and ch variables are potentially used uninitialized.
>>
>> They're not, bxt_port_to_phy_channel() initializes them in all code paths.
>>
>> > To make absolutely sure that these variables are not used
>> > uninitialized let's initialize these with known values as
>> > DPIO_PHY0 and DPIO_CH0, respectively.
>> >
>> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
>> > ---
>> > drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 4 ++--
>> > 1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
>> > b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
>> > index 8ea96cc524a1..45b67a3716e9 100644
>> > --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
>> > +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
>> > @@ -2174,8 +2174,8 @@ static bool bxt_ddi_pll_get_hw_state(struct intel_display *display,
>> > struct bxt_dpll_hw_state *hw_state = &dpll_hw_state->bxt;
>> > enum port port = (enum port)pll->info->id; /* 1:1 port->PLL mapping */
>> > intel_wakeref_t wakeref;
>> > - enum dpio_phy phy;
>> > - enum dpio_channel ch;
>> > + enum dpio_phy phy = DPIO_PHY0;
>> > + enum dpio_channel ch = DPIO_CH0;
>> > u32 val;
>> > bool ret;
>>
>> --
>> Jani Nikula, Intel
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-09-03 12:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 12:01 [PATCH] drm/i915/display: Initialize phy and ch variables Mika Kahola
2025-09-03 12:17 ` ✓ CI.KUnit: success for " Patchwork
2025-09-03 12:18 ` [PATCH] " Jani Nikula
2025-09-03 12:22 ` Kahola, Mika
2025-09-03 12:40 ` Jani Nikula [this message]
2025-09-05 9:18 ` Kahola, Mika
2025-09-03 12:51 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-09-03 20:00 ` ✓ Xe.CI.Full: " Patchwork
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=8a7129a9d1954dfbf0a3963d982fabe9feda7659@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=mika.kahola@intel.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