[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SJ1PR12MB6194C83D51101ACD97B55F0295689@SJ1PR12MB6194.namprd12.prod.outlook.com>
Date: Mon, 15 Aug 2022 15:17:57 +0000
From: "Dong, Ruijing" <Ruijing.Dong@....com>
To: Khalid Masum <khalid.masum.92@...il.com>,
"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>,
"linux-kernel-mentees@...ts.linuxfoundation.org"
<linux-kernel-mentees@...ts.linuxfoundation.org>
CC: "Deucher, Alexander" <Alexander.Deucher@....com>,
"Koenig, Christian" <Christian.Koenig@....com>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
"Zhu, James" <James.Zhu@....com>,
"Jiang, Sonny" <Sonny.Jiang@....com>,
Wan Jiabing <wanjiabing@...o.com>, "Liu, Leo" <Leo.Liu@....com>
Subject: RE: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in
vcn_v4_0_stop
[AMD Official Use Only - General]
If the condition was met and it came to execute vcn_4_0_stop_dpg_mode, then it would never have a chance to go for /*wait for vcn idle*/, isn't it?
I still didn't see obvious purpose of this change.
if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
==> r = vcn_v4_0_stop_dpg_mode(adev, i);
continue;
}
/* wait for vcn idle */
r = SOC15_WAIT_ON_RREG(VCN, i, regUVD_STATUS, UVD_STATUS__IDLE, 0x7);
Thanks
Ruijing
-----Original Message-----
From: Khalid Masum <khalid.masum.92@...il.com>
Sent: Monday, August 15, 2022 11:11 AM
To: Dong, Ruijing <Ruijing.Dong@....com>; amd-gfx@...ts.freedesktop.org; dri-devel@...ts.freedesktop.org; linux-kernel@...r.kernel.org; linux-kernel-mentees@...ts.linuxfoundation.org
Cc: Deucher, Alexander <Alexander.Deucher@....com>; Koenig, Christian <Christian.Koenig@....com>; Pan, Xinhui <Xinhui.Pan@....com>; David Airlie <airlied@...ux.ie>; Daniel Vetter <daniel@...ll.ch>; Zhu, James <James.Zhu@....com>; Jiang, Sonny <Sonny.Jiang@....com>; Wan Jiabing <wanjiabing@...o.com>; Liu, Leo <Leo.Liu@....com>
Subject: Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop
On 8/15/22 20:15, Dong, Ruijing wrote:
> [AMD Official Use Only - General]
>
> Sorry, which "r" value was overwritten? I didn't see the point of making this change.
>
> Thanks
> Ruijing
>
> -----Original Message-----
> From: Khalid Masum <khalid.masum.92@...il.com>
> Sent: Monday, August 15, 2022 3:01 AM
> To: amd-gfx@...ts.freedesktop.org; dri-devel@...ts.freedesktop.org;
> linux-kernel@...r.kernel.org;
> linux-kernel-mentees@...ts.linuxfoundation.org
> Cc: Deucher, Alexander <Alexander.Deucher@....com>; Koenig, Christian
> <Christian.Koenig@....com>; Pan, Xinhui <Xinhui.Pan@....com>; David
> Airlie <airlied@...ux.ie>; Daniel Vetter <daniel@...ll.ch>; Zhu, James
> <James.Zhu@....com>; Jiang, Sonny <Sonny.Jiang@....com>; Dong, Ruijing
> <Ruijing.Dong@....com>; Wan Jiabing <wanjiabing@...o.com>; Liu, Leo
> <Leo.Liu@....com>; Khalid Masum <khalid.masum.92@...il.com>
> Subject: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment
> in vcn_v4_0_stop
>
> The value assigned from vcn_v4_0_stop_dbg_mode to r is overwritten before it can be used. Remove this assignment.
>
> Addresses-Coverity: 1504988 ("Unused value")
> Fixes: 8da1170a16e4 ("drm/amdgpu: add VCN4 ip block support")
> Signed-off-by: Khalid Masum <khalid.masum.92@...il.com>
> ---
> drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
> b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
> index ca14c3ef742e..80b8a2c66b36 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
> @@ -1154,7 +1154,7 @@ static int vcn_v4_0_stop(struct amdgpu_device *adev)
> fw_shared->sq.queue_mode |= FW_QUEUE_DPG_HOLD_OFF;
>
> if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
> - r = vcn_v4_0_stop_dpg_mode(adev, i);
> + vcn_v4_0_stop_dpg_mode(adev, i);
> continue;
> }
>
> --
> 2.37.1
>
After value is overwritten soon right after the diff.
See:
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
static int vcn_v4_0_stop(struct amdgpu_device *adev) {
volatile struct amdgpu_vcn4_fw_shared *fw_shared; ...
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
fw_shared = adev->vcn.inst[i].fw_shared.cpu_addr;
fw_shared->sq.queue_mode |= FW_QUEUE_DPG_HOLD_OFF;
if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
r = vcn_v4_0_stop_dpg_mode(adev, i);
continue;
}
/* wait for vcn idle */
r = SOC15_WAIT_ON_RREG(VCN, i, regUVD_STATUS, UVD_STATUS__IDLE, 0x7);
Here, any value assigned to r is overwritten before it could be used. So the assignment in the true branch of the if statement here can be removed.
Thanks,
-- Khalid Masum
Powered by blists - more mailing lists