All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Tim" <Tim.Huang@amd.com>
To: "Zhang, Jesse(Jie)" <Jesse.Zhang@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Koenig, Christian" <Christian.Koenig@amd.com>,
	"Zhang, Jesse(Jie)" <Jesse.Zhang@amd.com>,
	"Zhang, Jesse(Jie)" <Jesse.Zhang@amd.com>
Subject: RE: [PATCH 3/3 V2] drm/amd/pm: fix the uninitialized scalar variable warning
Date: Mon, 29 Apr 2024 08:20:59 +0000	[thread overview]
Message-ID: <CH3PR12MB8074831AE74B6E3374FCCEB2F61B2@CH3PR12MB8074.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20240429021026.2059764-1-jesse.zhang@amd.com>

[AMD Official Use Only - General]

> -----Original Message-----
> From: Jesse Zhang <jesse.zhang@amd.com>
> Sent: Monday, April 29, 2024 10:10 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian
> <Christian.Koenig@amd.com>; Huang, Tim <Tim.Huang@amd.com>; Zhang,
> Jesse(Jie) <Jesse.Zhang@amd.com>; Zhang, Jesse(Jie) <Jesse.Zhang@amd.com>
> Subject: [PATCH 3/3 V2] drm/amd/pm: fix the uninitialized scalar variable
> warning
>
> Fix warning for using uninitialized values sclk_mask, mck_mask and soc_mask.
>  v2: Init the variables in the renoir_get_profiling_clk_mask(Tim Huang)
>
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
> ---
>  drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
> index 8908bbb3ff1f..546a2268823a 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
> @@ -253,6 +253,10 @@ static int renoir_get_profiling_clk_mask(struct
> smu_context *smu,
>                                        uint32_t *mclk_mask,
>                                        uint32_t *soc_mask)
>  {
> +     *sclk_mask = 0;
> +     /* mclk levels are in reverse order */
> +     *mclk_maks = NUM_MEMCLK_DPM_LEVELS - 1;
> +     *sock_mask = 0;
>
This is risky because the function may be called with an empty parameter pointer, like in the renoir_get_dpm_ultimate_freq.
Besides, for some profile mode, like the AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK, the default mask for sclk_mask and soc_mask maybe not 0.
IIRC, the smu13 use the default UMD_PSTATE frequency. Not sure whether Renoir apply this as well.

>       if (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) {
>               if (sclk_mask)
> --
> 2.25.1


      reply	other threads:[~2024-04-29  8:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29  2:10 [PATCH 3/3 V2] drm/amd/pm: fix the uninitialized scalar variable warning Jesse Zhang
2024-04-29  8:20 ` Huang, Tim [this message]

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=CH3PR12MB8074831AE74B6E3374FCCEB2F61B2@CH3PR12MB8074.namprd12.prod.outlook.com \
    --to=tim.huang@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Jesse.Zhang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.