Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp160799ybd; Sat, 22 Jun 2019 00:21:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqylOobFh/c/BIlxEb+pgaybYzHwMKVgGnfvoi4tuscZ9RAHQzMtPwHbOHPPLC2sEg9Tm11u X-Received: by 2002:a17:90a:d587:: with SMTP id v7mr11915488pju.28.1561188115739; Sat, 22 Jun 2019 00:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561188115; cv=none; d=google.com; s=arc-20160816; b=q9AlvUI7dS9Pe6EYBAdl9qDRQWJ5MAJeNla1M5lYdVn/2KG9GufxHBDtnWgHTBPhND 1MevCCC8xgpJoeKL5nszPmUKko/M07Xh+wumFzrhsIOBGGeph72D7f1WeqN0pEVsbrZi XbFtSAB7BkppZ9i+y9JrHFgNTkPSAoUj5tTOOXRsJB6g3e4n9yqT3QRsoqtW0MVRu9mx TIw0S8V7unu29ximUx7eTattOz+y7Kzj3kWWUK+Gatuuumg91wkIpeL8vUq0t9QY6N9K R69lSGhld/TwR70Hu6RWJkDMMRoNRDeWF4WN9buE77b5eMCJl510/tZ4tWLpKFkR5yDn LAwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=/nNaYV31nFS/LJQo1NsoAkKmcRa4AD/LVZSKQhUy7Vs=; b=sCwd2garEBvZiF+26WjbXveVuMbRQQAOMvaaVe3BGJgm3euD0akrtTEyiHDtWGwjyR 7tYV4nNp2wvzrKzcxGwBPbLjXt5EMo7+exyivYoDoQ5trJQUNw3El8vkJoE2Q2iPoA/z M/Ev/DsA2CvupBUvRciwrdi5OtpOsD7hnP/k2Bzdz+7KkWorooygz/rsVm/KyldcT2L1 BOH3KkuvrdxR/ZtSFVUt4/g7NN90i3T4NV0CSdRzRN5+UVo78UDpSMY+rEc/3fJdAWoc 8VR4TOdj6rxEopFFy3i1voN5nTNUiIs5aEQzebvde5yD7DByzlQkYKAYH7y1o2x39ySP YuBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k69si4592969pgc.85.2019.06.22.00.21.03; Sat, 22 Jun 2019 00:21:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726112AbfFVHVA (ORCPT + 99 others); Sat, 22 Jun 2019 03:21:00 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:18663 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726070AbfFVHVA (ORCPT ); Sat, 22 Jun 2019 03:21:00 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 66B90551CB76559889A1; Sat, 22 Jun 2019 15:20:55 +0800 (CST) Received: from [127.0.0.1] (10.177.96.96) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Sat, 22 Jun 2019 15:20:50 +0800 Subject: Re: [PATCH -next] drm/amdgpu: remove set but not used variables 'ret' To: Julia Lawall References: <20190622030314.169640-1-maowenan@huawei.com> CC: , , , , , , , From: maowenan Message-ID: <1a3b6f23-21cb-5931-b8fd-e8dd43e5cf2d@huawei.com> Date: Sat, 22 Jun 2019 15:20:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.96.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/6/22 14:02, Julia Lawall wrote: > > > On Sat, 22 Jun 2019, Mao Wenan wrote: > >> Fixes gcc '-Wunused-but-set-variable' warning: >> >> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’: >> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] >> int ret = 0; >> ^ >> >> It is never used since introduction in 9c7c85f7ea1f ("drm/amdgpu: add pmu counters") >> >> Signed-off-by: Mao Wenan >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c >> index 0e6dba9..0bf4dd9 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c >> @@ -246,12 +246,10 @@ static int init_pmu_by_type(struct amdgpu_device *adev, >> /* init amdgpu_pmu */ >> int amdgpu_pmu_init(struct amdgpu_device *adev) >> { >> - int ret = 0; >> - >> switch (adev->asic_type) { >> case CHIP_VEGA20: >> /* init df */ >> - ret = init_pmu_by_type(adev, df_v3_6_attr_groups, >> + init_pmu_by_type(adev, df_v3_6_attr_groups, >> "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF, >> DF_V3_6_MAX_COUNTERS); > > Maybe it would be better to use ret? > > If knowing whether the call has failed is really useless, then maybe the > return type should be void? right. amdgpu_pmu_init() is called by amdgpu_device_init() in drivers/gpu/drm/amd/amdgpu/amdgpu_device.c, which will use the return value. amdgpu_device_init() r = amdgpu_pmu_init(adev); thanks, I will send v2. > > julia > > >> >> -- >> 2.7.4 >> >> >