[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR12MB261982BB4DBCC90F70381121E42C9@DM6PR12MB2619.namprd12.prod.outlook.com>
Date: Mon, 7 Feb 2022 03:04:54 +0000
From: "Quan, Evan" <Evan.Quan@....com>
To: "trix@...hat.com" <trix@...hat.com>,
"Deucher, Alexander" <Alexander.Deucher@....com>,
"Koenig, Christian" <Christian.Koenig@....com>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
"airlied@...ux.ie" <airlied@...ux.ie>,
"daniel@...ll.ch" <daniel@...ll.ch>,
"nathan@...nel.org" <nathan@...nel.org>,
"ndesaulniers@...gle.com" <ndesaulniers@...gle.com>,
"Lazar, Lijo" <Lijo.Lazar@....com>,
"Powell, Darren" <Darren.Powell@....com>,
"Chen, Guchun" <Guchun.Chen@....com>,
"Grodzovsky, Andrey" <Andrey.Grodzovsky@....com>
CC: "amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"llvm@...ts.linux.dev" <llvm@...ts.linux.dev>
Subject: RE: [PATCH] drm/amd/pm: fix error handling
[AMD Official Use Only]
Reviewed-by: Evan Quan <evan.quan@....com>
> -----Original Message-----
> From: trix@...hat.com <trix@...hat.com>
> Sent: Saturday, February 5, 2022 11:00 PM
> To: Quan, Evan <Evan.Quan@....com>; Deucher, Alexander
> <Alexander.Deucher@....com>; Koenig, Christian
> <Christian.Koenig@....com>; Pan, Xinhui <Xinhui.Pan@....com>;
> airlied@...ux.ie; daniel@...ll.ch; nathan@...nel.org;
> ndesaulniers@...gle.com; Lazar, Lijo <Lijo.Lazar@....com>; Powell, Darren
> <Darren.Powell@....com>; Chen, Guchun <Guchun.Chen@....com>;
> Grodzovsky, Andrey <Andrey.Grodzovsky@....com>
> Cc: amd-gfx@...ts.freedesktop.org; dri-devel@...ts.freedesktop.org; linux-
> kernel@...r.kernel.org; llvm@...ts.linux.dev; Tom Rix <trix@...hat.com>
> Subject: [PATCH] drm/amd/pm: fix error handling
>
> From: Tom Rix <trix@...hat.com>
>
> clang static analysis reports this error
> amdgpu_smu.c:2289:9: warning: Called function pointer
> is null (null dereference)
> return smu->ppt_funcs->emit_clk_levels(
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> There is a logic error in the earlier check of
> emit_clk_levels. The error value is set to
> the ret variable but ret is never used. Return
> directly and remove the unneeded ret variable.
>
> Fixes: 5d64f9bbb628 ("amdgpu/pm: Implement new API function "emit" that
> accepts buffer base and write offset")
> Signed-off-by: Tom Rix <trix@...hat.com>
> ---
> drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index af368aa1fd0ae..5f3b3745a9b7a 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -2274,7 +2274,6 @@ static int smu_emit_ppclk_levels(void *handle,
> enum pp_clock_type type, char *bu
> {
> struct smu_context *smu = handle;
> enum smu_clk_type clk_type;
> - int ret = 0;
>
> clk_type = smu_convert_to_smuclk(type);
> if (clk_type == SMU_CLK_COUNT)
> @@ -2284,7 +2283,7 @@ static int smu_emit_ppclk_levels(void *handle,
> enum pp_clock_type type, char *bu
> return -EOPNOTSUPP;
>
> if (!smu->ppt_funcs->emit_clk_levels)
> - ret = -ENOENT;
> + return -ENOENT;
>
> return smu->ppt_funcs->emit_clk_levels(smu, clk_type, buf, offset);
>
> --
> 2.26.3
Powered by blists - more mailing lists