From: Khalid Masum <khalid.masum.92@gmail.com>
To: Greg KH <greg@kroah.com>
Cc: "Dong, Ruijing" <Ruijing.Dong@amd.com>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-kernel-mentees@lists.linuxfoundation.org"
<linux-kernel-mentees@lists.linuxfoundation.org>,
Wan Jiabing <wanjiabing@vivo.com>,
David Airlie <airlied@linux.ie>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
"Jiang, Sonny" <Sonny.Jiang@amd.com>,
Daniel Vetter <daniel@ffwll.ch>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Zhu, James" <James.Zhu@amd.com>, "Liu, Leo" <Leo.Liu@amd.com>,
"Koenig, Christian" <Christian.Koenig@amd.com>
Subject: Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop
Date: Mon, 15 Aug 2022 23:01:49 +0600 [thread overview]
Message-ID: <1e720378-8398-3e4a-5a77-e34b2fec58fd@gmail.com> (raw)
In-Reply-To: <YvpwVh359EMGa5kO@kroah.com>
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
prev parent reply other threads:[~2022-08-15 17:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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:15 ` Dong, Ruijing
2022-08-15 15:11 ` Khalid Masum
2022-08-15 15:17 ` Dong, Ruijing
2022-08-15 15:53 ` Khalid Masum
2022-08-15 16:00 ` Dong, Ruijing
2022-08-15 18:32 ` Khalid Masum
2022-08-15 16:12 ` Greg KH
2022-08-15 17:01 ` Khalid Masum [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=1e720378-8398-3e4a-5a77-e34b2fec58fd@gmail.com \
--to=khalid.masum.92@gmail.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=James.Zhu@amd.com \
--cc=Leo.Liu@amd.com \
--cc=Ruijing.Dong@amd.com \
--cc=Sonny.Jiang@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@linux.ie \
--cc=amd-gfx@lists.freedesktop.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=greg@kroah.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wanjiabing@vivo.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