From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13A3FC00140 for ; Mon, 15 Aug 2022 16:12:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230292AbiHOQMO (ORCPT ); Mon, 15 Aug 2022 12:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbiHOQML (ORCPT ); Mon, 15 Aug 2022 12:12:11 -0400 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 924C2D110 for ; Mon, 15 Aug 2022 09:12:10 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id BF8895C00ED; Mon, 15 Aug 2022 12:12:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 15 Aug 2022 12:12:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1660579929; x=1660666329; bh=rLRqhVPz0h hQSREG0KQPS/nirdZJabRaj8W098mmp6M=; b=0FTKcOkFtzuOjeemBBTaEzhrya RIAg0nko8kLNdqeiI0aMLMDbahNLctu/aMg65P1+ARi5z609hMokBOunDc9YTiKl C6gXoSGsXKY5YJAssH96skJ/VAPMnGdi70JXN2P9A9bYnJhSKl6Mfm5QcgqvZvmy yC1+OMu3Ke/AClIvjXWN079RHefo8eLCeA4XxhBdTHtKmpjasHijh7uaogV3Cx/M ixwxo6s39pCUU9V+ORyOzh5Hpy4pUHjXKES/ID4DIb8uGghEBOCDtNaGTTDeB2Sd 6mPd5Ui8GKTDGDCpd3EN8JXUDBOfBOIL8l9wvZSw9Cl7LVVHQzJrcMz78AYQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1660579929; x=1660666329; bh=rLRqhVPz0hhQSREG0KQPS/nirdZJ abRaj8W098mmp6M=; b=Hf40hsSlIzpjbwJfoFz7iCWzy0PmguLzmLOeuoEetc3l fvV8qHnybM9fqQTTKFys3VCQx0EpCdpK8MYu9eo7TIYuO3Zga3nV9MBFCXdSEDX7 CEytZxtG0DIMlnXmXpWJzrBFAqXUcC1gwbVwg1LRdUN8WNXNcThoyc+5l8TwPife 9/BI2YdgSCgQh7BgH6RXsyDNOB1w2o0Z1pll/BCcYiaYz5LKSrGQBG3zhqSNgxNe NYRIB0s+VEhdarleLfmnEEpT4mYUbmjvKz/TA6vhfVOOuW1smVhYsNEw0Sm/V8Uj 7LXIn2iM6JpPiLOcOmQAqDFN04a5wgriU0tVQGMjQw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdehvddgleelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepifhrvghg ucfmjfcuoehgrhgvgheskhhrohgrhhdrtghomheqnecuggftrfgrthhtvghrnhepheegvd evvdeljeeugfdtudduhfekledtiefhveejkeejuefhtdeufefhgfehkeetnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsehkrhhorg hhrdgtohhm X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Aug 2022 12:12:08 -0400 (EDT) Date: Mon, 15 Aug 2022 18:12:06 +0200 From: Greg KH To: Khalid Masum Cc: "Dong, Ruijing" , "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "linux-kernel-mentees@lists.linuxfoundation.org" , Wan Jiabing , David Airlie , "Pan, Xinhui" , "Jiang, Sonny" , Daniel Vetter , "Deucher, Alexander" , "Zhu, James" , "Liu, Leo" , "Koenig, Christian" Subject: Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop Message-ID: References: <20220815070056.10816-1-khalid.masum.92@gmail.com> <86088c17-585c-4a53-312d-ef339b824538@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86088c17-585c-4a53-312d-ef339b824538@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > 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 ; Koenig, Christian ; Pan, Xinhui ; David Airlie ; Daniel Vetter ; Zhu, James ; Jiang, Sonny ; Dong, Ruijing ; Wan Jiabing ; Liu, Leo ; Khalid Masum > > 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 > > --- > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA05CC25B0E for ; Mon, 15 Aug 2022 16:12:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 3C6E9410E9; Mon, 15 Aug 2022 16:12:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 3C6E9410E9 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=kroah.com header.i=@kroah.com header.a=rsa-sha256 header.s=fm1 header.b=0FTKcOkF; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=Hf40hsSl X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KLEGoIc4-AXf; Mon, 15 Aug 2022 16:12:16 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id B0E5A410AA; Mon, 15 Aug 2022 16:12:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org B0E5A410AA Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 80511C0032; Mon, 15 Aug 2022 16:12:15 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id D8E3DC002D for ; Mon, 15 Aug 2022 16:12:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 8BD6A83F24 for ; Mon, 15 Aug 2022 16:12:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 8BD6A83F24 Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kroah.com header.i=@kroah.com header.a=rsa-sha256 header.s=fm1 header.b=0FTKcOkF; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=Hf40hsSl X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AKAVGsht3yfu for ; Mon, 15 Aug 2022 16:12:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 864C883F19 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by smtp1.osuosl.org (Postfix) with ESMTPS id 864C883F19 for ; Mon, 15 Aug 2022 16:12:13 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id BF8895C00ED; Mon, 15 Aug 2022 12:12:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 15 Aug 2022 12:12:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1660579929; x=1660666329; bh=rLRqhVPz0h hQSREG0KQPS/nirdZJabRaj8W098mmp6M=; b=0FTKcOkFtzuOjeemBBTaEzhrya RIAg0nko8kLNdqeiI0aMLMDbahNLctu/aMg65P1+ARi5z609hMokBOunDc9YTiKl C6gXoSGsXKY5YJAssH96skJ/VAPMnGdi70JXN2P9A9bYnJhSKl6Mfm5QcgqvZvmy yC1+OMu3Ke/AClIvjXWN079RHefo8eLCeA4XxhBdTHtKmpjasHijh7uaogV3Cx/M ixwxo6s39pCUU9V+ORyOzh5Hpy4pUHjXKES/ID4DIb8uGghEBOCDtNaGTTDeB2Sd 6mPd5Ui8GKTDGDCpd3EN8JXUDBOfBOIL8l9wvZSw9Cl7LVVHQzJrcMz78AYQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1660579929; x=1660666329; bh=rLRqhVPz0hhQSREG0KQPS/nirdZJ abRaj8W098mmp6M=; b=Hf40hsSlIzpjbwJfoFz7iCWzy0PmguLzmLOeuoEetc3l fvV8qHnybM9fqQTTKFys3VCQx0EpCdpK8MYu9eo7TIYuO3Zga3nV9MBFCXdSEDX7 CEytZxtG0DIMlnXmXpWJzrBFAqXUcC1gwbVwg1LRdUN8WNXNcThoyc+5l8TwPife 9/BI2YdgSCgQh7BgH6RXsyDNOB1w2o0Z1pll/BCcYiaYz5LKSrGQBG3zhqSNgxNe NYRIB0s+VEhdarleLfmnEEpT4mYUbmjvKz/TA6vhfVOOuW1smVhYsNEw0Sm/V8Uj 7LXIn2iM6JpPiLOcOmQAqDFN04a5wgriU0tVQGMjQw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdehvddgleelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepifhrvghg ucfmjfcuoehgrhgvgheskhhrohgrhhdrtghomheqnecuggftrfgrthhtvghrnhepheegvd evvdeljeeugfdtudduhfekledtiefhveejkeejuefhtdeufefhgfehkeetnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsehkrhhorg hhrdgtohhm X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Aug 2022 12:12:08 -0400 (EDT) Date: Mon, 15 Aug 2022 18:12:06 +0200 From: Greg KH To: Khalid Masum Subject: Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop Message-ID: References: <20220815070056.10816-1-khalid.masum.92@gmail.com> <86088c17-585c-4a53-312d-ef339b824538@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <86088c17-585c-4a53-312d-ef339b824538@gmail.com> Cc: Wan Jiabing , David Airlie , "Liu, Leo" , "Pan, Xinhui" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Jiang, Sonny" , "amd-gfx@lists.freedesktop.org" , Daniel Vetter , "Deucher, Alexander" , "Dong, Ruijing" , "Zhu, James" , "linux-kernel-mentees@lists.linuxfoundation.org" , "Koenig, Christian" X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" 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 > > 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 ; Koenig, Christian ; Pan, Xinhui ; David Airlie ; Daniel Vetter ; Zhu, James ; Jiang, Sonny ; Dong, Ruijing ; Wan Jiabing ; Liu, Leo ; Khalid Masum > > 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 > > --- > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE94CC00140 for ; Mon, 15 Aug 2022 16:12:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A039C3BF6; Mon, 15 Aug 2022 16:12:30 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by gabe.freedesktop.org (Postfix) with ESMTPS id C762B10E1B8; Mon, 15 Aug 2022 16:12:10 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id BF8895C00ED; Mon, 15 Aug 2022 12:12:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 15 Aug 2022 12:12:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1660579929; x=1660666329; bh=rLRqhVPz0h hQSREG0KQPS/nirdZJabRaj8W098mmp6M=; b=0FTKcOkFtzuOjeemBBTaEzhrya RIAg0nko8kLNdqeiI0aMLMDbahNLctu/aMg65P1+ARi5z609hMokBOunDc9YTiKl C6gXoSGsXKY5YJAssH96skJ/VAPMnGdi70JXN2P9A9bYnJhSKl6Mfm5QcgqvZvmy yC1+OMu3Ke/AClIvjXWN079RHefo8eLCeA4XxhBdTHtKmpjasHijh7uaogV3Cx/M ixwxo6s39pCUU9V+ORyOzh5Hpy4pUHjXKES/ID4DIb8uGghEBOCDtNaGTTDeB2Sd 6mPd5Ui8GKTDGDCpd3EN8JXUDBOfBOIL8l9wvZSw9Cl7LVVHQzJrcMz78AYQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1660579929; x=1660666329; bh=rLRqhVPz0hhQSREG0KQPS/nirdZJ abRaj8W098mmp6M=; b=Hf40hsSlIzpjbwJfoFz7iCWzy0PmguLzmLOeuoEetc3l fvV8qHnybM9fqQTTKFys3VCQx0EpCdpK8MYu9eo7TIYuO3Zga3nV9MBFCXdSEDX7 CEytZxtG0DIMlnXmXpWJzrBFAqXUcC1gwbVwg1LRdUN8WNXNcThoyc+5l8TwPife 9/BI2YdgSCgQh7BgH6RXsyDNOB1w2o0Z1pll/BCcYiaYz5LKSrGQBG3zhqSNgxNe NYRIB0s+VEhdarleLfmnEEpT4mYUbmjvKz/TA6vhfVOOuW1smVhYsNEw0Sm/V8Uj 7LXIn2iM6JpPiLOcOmQAqDFN04a5wgriU0tVQGMjQw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdehvddgleelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepifhrvghg ucfmjfcuoehgrhgvgheskhhrohgrhhdrtghomheqnecuggftrfgrthhtvghrnhepheegvd evvdeljeeugfdtudduhfekledtiefhveejkeejuefhtdeufefhgfehkeetnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsehkrhhorg hhrdgtohhm X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Aug 2022 12:12:08 -0400 (EDT) Date: Mon, 15 Aug 2022 18:12:06 +0200 From: Greg KH To: Khalid Masum Subject: Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop Message-ID: References: <20220815070056.10816-1-khalid.masum.92@gmail.com> <86088c17-585c-4a53-312d-ef339b824538@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86088c17-585c-4a53-312d-ef339b824538@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wan Jiabing , David Airlie , "Liu, Leo" , "Pan, Xinhui" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Jiang, Sonny" , "amd-gfx@lists.freedesktop.org" , "Deucher, Alexander" , "Dong, Ruijing" , "Zhu, James" , "linux-kernel-mentees@lists.linuxfoundation.org" , "Koenig, Christian" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 > > 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 ; Koenig, Christian ; Pan, Xinhui ; David Airlie ; Daniel Vetter ; Zhu, James ; Jiang, Sonny ; Dong, Ruijing ; Wan Jiabing ; Liu, Leo ; Khalid Masum > > 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 > > --- > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2DCA1C25B0E for ; Mon, 15 Aug 2022 19:02:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C49AD268E; Mon, 15 Aug 2022 19:02:27 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by gabe.freedesktop.org (Postfix) with ESMTPS id C762B10E1B8; Mon, 15 Aug 2022 16:12:10 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id BF8895C00ED; Mon, 15 Aug 2022 12:12:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 15 Aug 2022 12:12:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1660579929; x=1660666329; bh=rLRqhVPz0h hQSREG0KQPS/nirdZJabRaj8W098mmp6M=; b=0FTKcOkFtzuOjeemBBTaEzhrya RIAg0nko8kLNdqeiI0aMLMDbahNLctu/aMg65P1+ARi5z609hMokBOunDc9YTiKl C6gXoSGsXKY5YJAssH96skJ/VAPMnGdi70JXN2P9A9bYnJhSKl6Mfm5QcgqvZvmy yC1+OMu3Ke/AClIvjXWN079RHefo8eLCeA4XxhBdTHtKmpjasHijh7uaogV3Cx/M ixwxo6s39pCUU9V+ORyOzh5Hpy4pUHjXKES/ID4DIb8uGghEBOCDtNaGTTDeB2Sd 6mPd5Ui8GKTDGDCpd3EN8JXUDBOfBOIL8l9wvZSw9Cl7LVVHQzJrcMz78AYQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1660579929; x=1660666329; bh=rLRqhVPz0hhQSREG0KQPS/nirdZJ abRaj8W098mmp6M=; b=Hf40hsSlIzpjbwJfoFz7iCWzy0PmguLzmLOeuoEetc3l fvV8qHnybM9fqQTTKFys3VCQx0EpCdpK8MYu9eo7TIYuO3Zga3nV9MBFCXdSEDX7 CEytZxtG0DIMlnXmXpWJzrBFAqXUcC1gwbVwg1LRdUN8WNXNcThoyc+5l8TwPife 9/BI2YdgSCgQh7BgH6RXsyDNOB1w2o0Z1pll/BCcYiaYz5LKSrGQBG3zhqSNgxNe NYRIB0s+VEhdarleLfmnEEpT4mYUbmjvKz/TA6vhfVOOuW1smVhYsNEw0Sm/V8Uj 7LXIn2iM6JpPiLOcOmQAqDFN04a5wgriU0tVQGMjQw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdehvddgleelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepifhrvghg ucfmjfcuoehgrhgvgheskhhrohgrhhdrtghomheqnecuggftrfgrthhtvghrnhepheegvd evvdeljeeugfdtudduhfekledtiefhveejkeejuefhtdeufefhgfehkeetnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsehkrhhorg hhrdgtohhm X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Aug 2022 12:12:08 -0400 (EDT) Date: Mon, 15 Aug 2022 18:12:06 +0200 From: Greg KH To: Khalid Masum Subject: Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop Message-ID: References: <20220815070056.10816-1-khalid.masum.92@gmail.com> <86088c17-585c-4a53-312d-ef339b824538@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86088c17-585c-4a53-312d-ef339b824538@gmail.com> X-Mailman-Approved-At: Mon, 15 Aug 2022 19:02:05 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wan Jiabing , David Airlie , "Liu, Leo" , "Pan, Xinhui" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Jiang, Sonny" , "amd-gfx@lists.freedesktop.org" , Daniel Vetter , "Deucher, Alexander" , "Dong, Ruijing" , "Zhu, James" , "linux-kernel-mentees@lists.linuxfoundation.org" , "Koenig, Christian" Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" 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 > > 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 ; Koenig, Christian ; Pan, Xinhui ; David Airlie ; Daniel Vetter ; Zhu, James ; Jiang, Sonny ; Dong, Ruijing ; Wan Jiabing ; Liu, Leo ; Khalid Masum > > 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 > > --- > > 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