Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2723245rwb; Mon, 15 Aug 2022 10:13:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR4RnvAz5/163Rd/BfJbCIgwvpKJ21eVtir089nNZ3BIO+vR4yuJsZtbA2oZPMmkGPCXCODu X-Received: by 2002:a17:902:e5cc:b0:16f:1e31:da6c with SMTP id u12-20020a170902e5cc00b0016f1e31da6cmr17777877plf.66.1660583587156; Mon, 15 Aug 2022 10:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660583587; cv=none; d=google.com; s=arc-20160816; b=PPlc7EqfiE/1iwD9y8J6iLvC5VEqU5oWv9EdXTCojGGz6lIkgZJHAIQ4oKMyAehcD+ 48SwAjMYWKa0irSJpJtM/NP/hJnkBBA+9ZmqhCjROVtLSGEqpvcLysIz4c2xFOxx3A6b ILckE3AHKeKXlTe7p7HzNOwsxYSNAY/KnuHzS5VnyxzEdrx6ly2yWPoraQ1tIZdjDzWE xveNhiBH2t9mMOJWstdzL47IW9ukOg0CAqgU7AnmpzY88swAXxzg/Ioio03/qxslTKpz yaQOHCT6Yg00YNWac/LUmiqLuMzjE601q0n1ZPXHSaYGVWIMVnFd5qYM3pJzYUdBwXvz +6Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=kVI9j3DYdqBdWkziBWW1kk/pn2Ueg4C4jZV3ff8Htjw=; b=vjC6J4X9acO7qX96mSkiMS/2LEseXtkkD6BsaQBjVEy0laNZQNtgNvltv9S8T5BDiv AuiDVgHXJClQZCBuLRWpG4Uv7LH6Hv1Kk1x0h+nK1wxXl6/uVuQruiZUsIKrqV1eSNAJ X9YLkU2VMqWwuZU/D761UYTP2IczSKJfcFfpEJkUo3bGohUvu1RvsDinaLtTXSpO2e57 eDajGPMLzpd3SnJosoWaleyf+A2L8l/NNCKEEcMmvyWUFfQht1ukyZHC2vpCjDnvUSqj i0K4DwTdhMjn+2+4Mhg7q1tTn42bJB8BQfyy8Wmu5hpo/2b0S4X48EvmYuvhITAQWcBl ysCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gZqQLXqc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x187-20020a6363c4000000b0041bb3b63950si10690751pgb.367.2022.08.15.10.12.56; Mon, 15 Aug 2022 10:13:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gZqQLXqc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232285AbiHORCI (ORCPT + 99 others); Mon, 15 Aug 2022 13:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231990AbiHORCF (ORCPT ); Mon, 15 Aug 2022 13:02:05 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB1E27CC4 for ; Mon, 15 Aug 2022 10:02:02 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id f192so7083628pfa.9 for ; Mon, 15 Aug 2022 10:02:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=kVI9j3DYdqBdWkziBWW1kk/pn2Ueg4C4jZV3ff8Htjw=; b=gZqQLXqcl92oRRJt+5e5u2qjisa8kzB6aZhxd9PIhqUmCxltZj383GoU8Cz3j8Tk4c vN3dentoCQF+MRI0FvyRZDu3ppO1yOn+l9OA8GhHnGrLqRWgaIjY5eBqJDZC13icn8hw +JAwQvLxC0EWZOG74h3jwKTqvyhuQAgdTqTQO3xsOZuG6xc4trx06//kNQR1Qf0Ld1Qt tKFvpd6kAwyjbVJ8t5yuX1bSinVtAAjspK7Ilp9HakXaNORZYJnsYGPk0LyRyExCiuIq zgLrz1HmdPJhISBHvYLb3Ttimvk0hFUuuNhLGuw8c59leJyeKyuYyxmeeXGhUtcLAc0k 0nSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=kVI9j3DYdqBdWkziBWW1kk/pn2Ueg4C4jZV3ff8Htjw=; b=bPuOGX//T9oWqzYnJWxJUTISlSYWsZw4l2j/s9OZ/ayqrvSckwnar0FoM2YlNjdXbO vRSw3knbpmfh1KD6LrzlbIpKvl6ZlaVNQrsBJwoqQXJxUXWYj4Fcad4T2NDJd3kZMJT8 Srjhh54/2H89bJesaPO2COiMbbOP3ecHUNkDs6D3Ae51Jd3wfpsUySWLWyf8AzUoIkHG 4vCi4ljsGB2JOYjSn/P03FfYuLunWqbagp7JnRzhSHfmz/Xyn3g8nbFPRODp7faWTHBN mMcXAh99gAIFtP4T7UrpHdKKS5s/IMPt3kOQzkc36v7RL7tfp1tYe3SpVhFrK2DxrJg7 6lSw== X-Gm-Message-State: ACgBeo21CGVR1p67RULtIlT+2YooO8j/Ma9w4mbW94j6Ac7SaPCNon1r N4XoPCWo22eNjoOVILRy8GE= X-Received: by 2002:aa7:88d1:0:b0:52e:f8e:aab5 with SMTP id k17-20020aa788d1000000b0052e0f8eaab5mr17090966pff.63.1660582921848; Mon, 15 Aug 2022 10:02:01 -0700 (PDT) Received: from [192.168.0.110] ([103.159.189.138]) by smtp.gmail.com with ESMTPSA id l20-20020a17090b079400b001f89383d587sm4767063pjz.56.2022.08.15.10.01.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Aug 2022 10:02:01 -0700 (PDT) Message-ID: <1e720378-8398-3e4a-5a77-e34b2fec58fd@gmail.com> Date: Mon, 15 Aug 2022 23:01:49 +0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH linux-next] drm/amdgpu/vcn: Remove unused assignment in vcn_v4_0_stop Content-Language: en-US To: Greg KH 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" References: <20220815070056.10816-1-khalid.masum.92@gmail.com> <86088c17-585c-4a53-312d-ef339b824538@gmail.com> From: Khalid Masum In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>> 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. That makes sense. I shall send a v2 this way. Thanks for your suggestion. > > thanks, > > greg k-h thanks, -- Khalid Masum