From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: trix@redhat.com, evan.quan@amd.com, alexander.deucher@amd.com,
christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@linux.ie,
daniel@ffwll.ch, nathan@kernel.org, ndesaulniers@google.com,
darren.powell@amd.com, guchun.chen@amd.com,
Arunpravin.PaneerSelvam@amd.com, andrey.grodzovsky@amd.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] drm/amd/pm: set min,max to 0 if there is no get_dpm_ultimate_freq function
Date: Mon, 24 Jan 2022 19:52:49 +0530 [thread overview]
Message-ID: <9beb041b-b757-311c-5ea1-1b9fa1d63074@amd.com> (raw)
In-Reply-To: <20220124135259.1057828-1-trix@redhat.com>
On 1/24/2022 7:22 PM, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> clang static analysis reports this represenative problem
> amdgpu_smu.c:144:18: warning: The left operand of '*' is a garbage value
> return clk_freq * 100;
> ~~~~~~~~ ^
>
> If there is no get_dpm_ultimate_freq function,
> smu_get_dpm_freq_range returns success without setting the
> output min,max parameters. Because this is an extern function,
> set the min,max to 0 when there is no get_dpm_ultimate_freq.
>
> Fixes: e5ef784b1e17 ("drm/amd/powerplay: revise calling chain on retrieving frequency range")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index 5ace30434e603..35fbe51f52eaa 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -121,11 +121,17 @@ int smu_get_dpm_freq_range(struct smu_context *smu,
> if (!min && !max)
> return -EINVAL;
>
> - if (smu->ppt_funcs->get_dpm_ultimate_freq)
> + if (smu->ppt_funcs->get_dpm_ultimate_freq) {
> ret = smu->ppt_funcs->get_dpm_ultimate_freq(smu,
> clk_type,
> min,
> max);
> + } else {
return -ENOTSUPP; would be more appropriate.
Thanks,
Lijo
> + if (min)
> + *min = 0;
> + if (max)
> + *max = 0;
> + }
>
> return ret;
> }
>
prev parent reply other threads:[~2022-01-24 14:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 13:52 [PATCH] drm/amd/pm: set min,max to 0 if there is no get_dpm_ultimate_freq function trix
2022-01-24 14:22 ` Lazar, Lijo [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=9beb041b-b757-311c-5ea1-1b9fa1d63074@amd.com \
--to=lijo.lazar@amd.com \
--cc=Arunpravin.PaneerSelvam@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andrey.grodzovsky@amd.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=darren.powell@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=evan.quan@amd.com \
--cc=guchun.chen@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=trix@redhat.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