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