* [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop @ 2022-08-15 7:00 Khalid Masum 2022-08-15 14:07 ` James Zhu via Linux-kernel-mentees 2022-08-15 14:15 ` Dong, Ruijing via Linux-kernel-mentees 0 siblings, 2 replies; 10+ messages in thread From: Khalid Masum @ 2022-08-15 7:00 UTC (permalink / raw) To: amd-gfx, dri-devel, linux-kernel, linux-kernel-mentees Cc: Wan Jiabing, David Airlie, Pan Xinhui, Sonny Jiang, Daniel Vetter, Alex Deucher, Ruijing Dong, James Zhu, Leo Liu, Christian König 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@gmail.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 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop 2022-08-15 7:00 [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop Khalid Masum @ 2022-08-15 14:07 ` James Zhu via Linux-kernel-mentees 2022-08-15 14:15 ` Dong, Ruijing via Linux-kernel-mentees 1 sibling, 0 replies; 10+ messages in thread From: James Zhu via Linux-kernel-mentees @ 2022-08-15 14:07 UTC (permalink / raw) To: Khalid Masum, amd-gfx, dri-devel, linux-kernel, linux-kernel-mentees Cc: Wan Jiabing, David Airlie, Pan Xinhui, Sonny Jiang, Daniel Vetter, Alex Deucher, Ruijing Dong, James Zhu, Leo Liu, Christian König [-- Attachment #1.1: Type: text/plain, Size: 1022 bytes --] ThispatchisReviewed-by:JamesZhu<James.Zhu@amd.com> On 2022-08-15 3:00 a.m., Khalid Masum wrote: > 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@gmail.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; > } > [-- Attachment #1.2: Type: text/html, Size: 1933 bytes --] [-- Attachment #2: Type: text/plain, Size: 201 bytes --] _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop 2022-08-15 7:00 [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop Khalid Masum 2022-08-15 14:07 ` James Zhu via Linux-kernel-mentees @ 2022-08-15 14:15 ` Dong, Ruijing via Linux-kernel-mentees 2022-08-15 15:11 ` Khalid Masum 1 sibling, 1 reply; 10+ messages in thread From: Dong, Ruijing via Linux-kernel-mentees @ 2022-08-15 14:15 UTC (permalink / raw) To: Khalid Masum, amd-gfx, dri-devel, linux-kernel, linux-kernel-mentees Cc: Wan Jiabing, David Airlie, Pan, Xinhui, Jiang, Sonny, Daniel Vetter, Deucher, Alexander, Zhu, James, Liu, Leo, Koenig, Christian [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@gmail.com> Sent: Monday, August 15, 2022 3:01 AM To: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; linux-kernel-mentees@lists.linuxfoundation.org Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter <daniel@ffwll.ch>; Zhu, James <James.Zhu@amd.com>; Jiang, Sonny <Sonny.Jiang@amd.com>; Dong, Ruijing <Ruijing.Dong@amd.com>; Wan Jiabing <wanjiabing@vivo.com>; Liu, Leo <Leo.Liu@amd.com>; Khalid Masum <khalid.masum.92@gmail.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@gmail.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 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop 2022-08-15 14:15 ` Dong, Ruijing via Linux-kernel-mentees @ 2022-08-15 15:11 ` Khalid Masum 2022-08-15 15:17 ` Dong, Ruijing via Linux-kernel-mentees 2022-08-15 16:12 ` Greg KH 0 siblings, 2 replies; 10+ messages in thread From: Khalid Masum @ 2022-08-15 15:11 UTC (permalink / raw) To: Dong, Ruijing, amd-gfx, dri-devel, linux-kernel, linux-kernel-mentees Cc: Wan Jiabing, David Airlie, Pan, Xinhui, Jiang, Sonny, Daniel Vetter, Deucher, Alexander, Zhu, James, Liu, Leo, Koenig, Christian 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@gmail.com> > Sent: Monday, August 15, 2022 3:01 AM > To: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; linux-kernel-mentees@lists.linuxfoundation.org > Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter <daniel@ffwll.ch>; Zhu, James <James.Zhu@amd.com>; Jiang, Sonny <Sonny.Jiang@amd.com>; Dong, Ruijing <Ruijing.Dong@amd.com>; Wan Jiabing <wanjiabing@vivo.com>; Liu, Leo <Leo.Liu@amd.com>; Khalid Masum <khalid.masum.92@gmail.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@gmail.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 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop 2022-08-15 15:11 ` Khalid Masum @ 2022-08-15 15:17 ` Dong, Ruijing via Linux-kernel-mentees 2022-08-15 15:53 ` Khalid Masum 2022-08-15 16:12 ` Greg KH 1 sibling, 1 reply; 10+ messages in thread From: Dong, Ruijing via Linux-kernel-mentees @ 2022-08-15 15:17 UTC (permalink / raw) To: Khalid Masum, amd-gfx, dri-devel, linux-kernel, linux-kernel-mentees Cc: Wan Jiabing, David Airlie, Pan, Xinhui, Jiang, Sonny, Daniel Vetter, Deucher, Alexander, Zhu, James, Liu, Leo, Koenig, Christian [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@gmail.com> Sent: Monday, August 15, 2022 11:11 AM To: Dong, Ruijing <Ruijing.Dong@amd.com>; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; linux-kernel-mentees@lists.linuxfoundation.org Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter <daniel@ffwll.ch>; Zhu, James <James.Zhu@amd.com>; Jiang, Sonny <Sonny.Jiang@amd.com>; Wan Jiabing <wanjiabing@vivo.com>; Liu, Leo <Leo.Liu@amd.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@gmail.com> > Sent: Monday, August 15, 2022 3:01 AM > To: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; > linux-kernel@vger.kernel.org; > linux-kernel-mentees@lists.linuxfoundation.org > Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian > <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; David > Airlie <airlied@linux.ie>; Daniel Vetter <daniel@ffwll.ch>; Zhu, James > <James.Zhu@amd.com>; Jiang, Sonny <Sonny.Jiang@amd.com>; Dong, Ruijing > <Ruijing.Dong@amd.com>; Wan Jiabing <wanjiabing@vivo.com>; Liu, Leo > <Leo.Liu@amd.com>; Khalid Masum <khalid.masum.92@gmail.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@gmail.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 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop 2022-08-15 15:17 ` Dong, Ruijing via Linux-kernel-mentees @ 2022-08-15 15:53 ` Khalid Masum 2022-08-15 16:00 ` Dong, Ruijing via Linux-kernel-mentees 0 siblings, 1 reply; 10+ messages in thread From: Khalid Masum @ 2022-08-15 15:53 UTC (permalink / raw) To: Dong, Ruijing, amd-gfx, dri-devel, linux-kernel, linux-kernel-mentees Cc: Wan Jiabing, David Airlie, Pan, Xinhui, Jiang, Sonny, Daniel Vetter, Deucher, Alexander, Zhu, James, Liu, Leo, Koenig, Christian On 8/15/22 21:17, Dong, Ruijing wrote: > [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? Hypothetically, some other thread might set adev->pg_flags NULL and in that case it will get the chance to go for /* wait for vcn idle */. > 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); Regardless of that, this assignment to r is unnecessary. Because this value of r is never used. This patch simply removes this unnecessary assignment. > continue; > } > > /* wait for vcn idle */ > r = SOC15_WAIT_ON_RREG(VCN, i, regUVD_STATUS, UVD_STATUS__IDLE, 0x7); > > Thanks > Ruijing > Thanks, -- Khalid Masum _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop 2022-08-15 15:53 ` Khalid Masum @ 2022-08-15 16:00 ` Dong, Ruijing via Linux-kernel-mentees 2022-08-15 18:32 ` Khalid Masum 0 siblings, 1 reply; 10+ messages in thread From: Dong, Ruijing via Linux-kernel-mentees @ 2022-08-15 16:00 UTC (permalink / raw) To: Khalid Masum, amd-gfx, dri-devel, linux-kernel, linux-kernel-mentees Cc: Wan Jiabing, David Airlie, Pan, Xinhui, Jiang, Sonny, Daniel Vetter, Deucher, Alexander, Zhu, James, Liu, Leo, Koenig, Christian [AMD Official Use Only - General] Then please update commit message, this change is due to "value r is never used, and remove unnecessary assignment", that makes sense to me. Thanks Ruijing -----Original Message----- From: Khalid Masum <khalid.masum.92@gmail.com> Sent: Monday, August 15, 2022 11:54 AM To: Dong, Ruijing <Ruijing.Dong@amd.com>; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; linux-kernel-mentees@lists.linuxfoundation.org Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter <daniel@ffwll.ch>; Zhu, James <James.Zhu@amd.com>; Jiang, Sonny <Sonny.Jiang@amd.com>; Wan Jiabing <wanjiabing@vivo.com>; Liu, Leo <Leo.Liu@amd.com> Subject: Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop On 8/15/22 21:17, Dong, Ruijing wrote: > [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? Hypothetically, some other thread might set adev->pg_flags NULL and in that case it will get the chance to go for /* wait for vcn idle */. > 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); Regardless of that, this assignment to r is unnecessary. Because this value of r is never used. This patch simply removes this unnecessary assignment. > continue; > } > > /* wait for vcn idle */ > r = SOC15_WAIT_ON_RREG(VCN, i, regUVD_STATUS, UVD_STATUS__IDLE, 0x7); > > Thanks > Ruijing > Thanks, -- Khalid Masum _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop 2022-08-15 16:00 ` Dong, Ruijing via Linux-kernel-mentees @ 2022-08-15 18:32 ` Khalid Masum 0 siblings, 0 replies; 10+ messages in thread From: Khalid Masum @ 2022-08-15 18:32 UTC (permalink / raw) To: Dong, Ruijing, amd-gfx, dri-devel, linux-kernel, linux-kernel-mentees Cc: Wan Jiabing, David Airlie, Pan, Xinhui, Jiang, Sonny, Daniel Vetter, Deucher, Alexander, Zhu, James, Liu, Leo, Koenig, Christian On 8/15/22 22:00, Dong, Ruijing wrote: > [AMD Official Use Only - General] > > Then please update commit message, this change is due to "value r is never used, and remove unnecessary assignment", that makes sense to me. > > Thanks > Ruijing > Greg also pointed out that the function vcn_v4_0_stop_dpg_mode should return void. I shall send a patch shortly with these two changes. Thanks for your suggestion. Thanks, -- Khalid Masum _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop 2022-08-15 15:11 ` Khalid Masum 2022-08-15 15:17 ` Dong, Ruijing via Linux-kernel-mentees @ 2022-08-15 16:12 ` Greg KH 2022-08-15 17:01 ` Khalid Masum 1 sibling, 1 reply; 10+ messages in thread From: Greg KH @ 2022-08-15 16:12 UTC (permalink / raw) To: Khalid Masum Cc: Wan Jiabing, David Airlie, Liu, Leo, Pan, Xinhui, linux-kernel, dri-devel, Jiang, Sonny, amd-gfx, Daniel Vetter, Deucher, Alexander, Dong, Ruijing, Zhu, James, linux-kernel-mentees, Koenig, Christian On Mon, Aug 15, 2022 at 09:11:18PM +0600, Khalid Masum wrote: > 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@gmail.com> > > Sent: Monday, August 15, 2022 3:01 AM > > To: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; linux-kernel-mentees@lists.linuxfoundation.org > > Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter <daniel@ffwll.ch>; Zhu, James <James.Zhu@amd.com>; Jiang, Sonny <Sonny.Jiang@amd.com>; Dong, Ruijing <Ruijing.Dong@amd.com>; Wan Jiabing <wanjiabing@vivo.com>; Liu, Leo <Leo.Liu@amd.com>; Khalid Masum <khalid.masum.92@gmail.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@gmail.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. Why not fix vcn_v4_0_stop_dpg_mode() to not return anything, as it does not, and then remove this assignment as well, which would fix up everything at once to be more obvious what is happening and why. thanks, greg k-h _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop 2022-08-15 16:12 ` Greg KH @ 2022-08-15 17:01 ` Khalid Masum 0 siblings, 0 replies; 10+ messages in thread From: Khalid Masum @ 2022-08-15 17:01 UTC (permalink / raw) To: Greg KH Cc: Wan Jiabing, David Airlie, Liu, Leo, Pan, Xinhui, linux-kernel, dri-devel, Jiang, Sonny, amd-gfx, Daniel Vetter, Deucher, Alexander, Dong, Ruijing, Zhu, James, linux-kernel-mentees, Koenig, Christian On 8/15/22 22:12, Greg KH wrote: > On Mon, Aug 15, 2022 at 09:11:18PM +0600, Khalid Masum wrote: >> 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@gmail.com> >>> Sent: Monday, August 15, 2022 3:01 AM >>> To: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; linux-kernel-mentees@lists.linuxfoundation.org >>> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter <daniel@ffwll.ch>; Zhu, James <James.Zhu@amd.com>; Jiang, Sonny <Sonny.Jiang@amd.com>; Dong, Ruijing <Ruijing.Dong@amd.com>; Wan Jiabing <wanjiabing@vivo.com>; Liu, Leo <Leo.Liu@amd.com>; Khalid Masum <khalid.masum.92@gmail.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@gmail.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. > > Why not fix vcn_v4_0_stop_dpg_mode() to not return anything, as it does > not, and then remove this assignment as well, which would fix up > everything at once to be more obvious what is happening and why. That makes sense. I shall send a v2 this way. Thanks for your suggestion. > > thanks, > > greg k-h thanks, -- Khalid Masum _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-08-15 18:33 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-08-15 7:00 [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop Khalid Masum 2022-08-15 14:07 ` James Zhu via Linux-kernel-mentees 2022-08-15 14:15 ` Dong, Ruijing via Linux-kernel-mentees 2022-08-15 15:11 ` Khalid Masum 2022-08-15 15:17 ` Dong, Ruijing via Linux-kernel-mentees 2022-08-15 15:53 ` Khalid Masum 2022-08-15 16:00 ` Dong, Ruijing via Linux-kernel-mentees 2022-08-15 18:32 ` Khalid Masum 2022-08-15 16:12 ` Greg KH 2022-08-15 17:01 ` Khalid Masum
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).