Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1942849ybd; Sun, 23 Jun 2019 20:41:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRP8qCkMFqjruRLcIvhLVYr+ZUa6u5u9d1HXZwWo8WANWz4kegZJDjblraB+82jEdL52/H X-Received: by 2002:a63:5d54:: with SMTP id o20mr29412793pgm.97.1561347687742; Sun, 23 Jun 2019 20:41:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561347687; cv=none; d=google.com; s=arc-20160816; b=V6Ilx3rUoBiipbkgnLl7SjZbtGIcsmZyswj5siVxlqBEqqL2Qt399OKL0VqXfidWCs ZTWUPe/QU7+pMInVGf8YY95iQbCxizE2XaJ8K/vQyLWaSSJr58YW1p9q/UIuJ+fzBZBw GwzaTgpCJG6pMn+EEJxKmOtix/lh5FjBfcTiiqNseLZ0V+tQqJSHajEqrlmuFxwkCOlp kTEPayrGciT94B6nGDMk1dsyKTB0Koq8GCmB1RBMdcQLZNhQ+d7/lf5I6yG8nocI0W+P MwzwjpS8KjsIXl+ri3oXjwBY8eTgB5NtsP/Kw9YDbwvNihZsVoVR8ehyWvq2HFvKAmXJ Zgjg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=R2IZyVjPbSxwGoTvKV4mHqOf4O609LiF1KMVUaiZPCE=; b=PbWmiz2erFwtJxd3fH1Cd5EnstowzhdWA25mKU3sJBwde+Pd4JvsQSwvUvfTt+90nX cXjCk7kNzx7fSQspFjYUf/oLjx65F25QtrMaj74r4iIQheXY5pVynQSN7t3R6nFmR+mY 6PD9+b0rHPKhohHqGc8DmbOgC4pquuTE4RCAe4xSS16z9U0Wj6N+QQfWW7z9RXIiGhwc ZBixM92XaWBCCy/fvPhKip95UGa4+CuRQlfaMlfSm6aquopv34A7inY83MUXa+qx63jV U1hhytS18DddBVvxtFjWVrbzF5OMg0NdUkXFOo9iUEP3TWc/Dyo/uchABRYbvukQQdMf YFSw== 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 a14si9473920pga.567.2019.06.23.20.41.11; Sun, 23 Jun 2019 20:41:27 -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 S1727668AbfFXDiv (ORCPT + 99 others); Sun, 23 Jun 2019 23:38:51 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:19098 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727290AbfFXDiv (ORCPT ); Sun, 23 Jun 2019 23:38:51 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 61310B675E14D312AA48; Mon, 24 Jun 2019 11:38:44 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Mon, 24 Jun 2019 11:38:34 +0800 From: Mao Wenan To: , , , , , , CC: , , , , Mao Wenan Subject: [PATCH -next v3] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init Date: Mon, 24 Jun 2019 11:45:32 +0800 Message-ID: <20190624034532.135201-1-maowenan@huawei.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is one 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; ^ amdgpu_pmu_init() is called by amdgpu_device_init() in drivers/gpu/drm/amd/amdgpu/amdgpu_device.c, which will use the return value. So it should return 'ret' immediately if init_pmu_by_type() failed. amdgpu_device_init() r = amdgpu_pmu_init(adev); This patch is also to update the indenting on the arguments so they line up with the '('. Fixes: 9c7c85f7ea1f ("drm/amdgpu: add pmu counters") Signed-off-by: Mao Wenan --- v1->v2: change the subject for this patch; change the indenting when it calls init_pmu_by_type; use the value 'ret' in amdgpu_pmu_init(). v2->v3: change the subject for this patch; return 'ret' immediately if failed to call init_pmu_by_type(). drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c index 0e6dba9..b702322 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c @@ -252,8 +252,11 @@ int amdgpu_pmu_init(struct amdgpu_device *adev) case CHIP_VEGA20: /* init df */ ret = init_pmu_by_type(adev, df_v3_6_attr_groups, - "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF, - DF_V3_6_MAX_COUNTERS); + "DF", "amdgpu_df", + PERF_TYPE_AMDGPU_DF, + DF_V3_6_MAX_COUNTERS); + if (ret) + return ret; /* other pmu types go here*/ break; -- 2.7.4