Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7362921rdb; Wed, 3 Jan 2024 13:20:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzdsAnPpIVsQbC574Y8NdQGwVjNOlmp93svFQtZMqUrhDU97Iar5GF2IL6bCRFs1MD3qND X-Received: by 2002:a17:906:a2d2:b0:a28:68be:d60a with SMTP id by18-20020a170906a2d200b00a2868bed60amr1159421ejb.190.1704316801654; Wed, 03 Jan 2024 13:20:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704316801; cv=none; d=google.com; s=arc-20160816; b=WlnqxECU+h3dAR+fVYCYMZu/Uawf//8J++wyD03lpUFc5F0eLcodag8KTPbzkSjNoM qlY1OIcUO1+HwbYXJO0hZU0IM3fhUAXHc+vVpl72mZFhsz/Yl58jn30o+Y/znSfO6yd5 1Z1HHaNIHLcxyn+bNVJZzdMY+f1IX2Uqj06q1Qa13VB9xFmGaBlcH+Ki8dqcE+HudD3Q ZE8NHzeZY8PZcbUOzEtrFc73A0TBLlvZhSCjfTkXLrKk4K8zkaD4ZbUUa5MuhyxBaMIz sV/vS2xvB1mvu+J97negcc2qskaSU6HC61aK9Bhd3S0a5dqNhGnFLMa4epqSdNFDvY53 IOMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BQlxmeo/QH3Ibb7Z7kh6SpPPDl2nZ9eRcjwlx4ZIFTw=; fh=BY3SQ2QXZN/f5mUNAf1FeSijt1R/ujJln7ZlLqBjGPU=; b=lCRXVFv3Oi7JinsDQynvOiro0gqHPp8bLbdMHCDAlRXSk0cP1j4QwrMt4UoYvO1yjK MLwzKJ++iJeHl3pwbo5MSLWe1Bi8JxntDnsLjqFoeLKqJKOPbGVN14yAoT0wWrSq0+GL ip+2G4f1Kzi2QK0dG51hMS4Tu2ALcU+MzNcHG2FkIPGM0gPbaB6k2t2eVDuRnHg6rQ7G N4xn1rrs8HXvA2P/M63+8uYKRMZ0rkmZfW0I/b2iauymtGq92KMl/cV+GCeoyGrevBo2 N4V7lG57Ezg2nPfpn6i9wZoCThac35fiD9ed0G/iQo0nzfyWvvcb7JhUgBX4vnj6CU1Q rjMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fIwBTq+F; spf=pass (google.com: domain of linux-kernel+bounces-16016-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16016-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qw14-20020a170906fcae00b00a28c8dde2b4si148574ejb.938.2024.01.03.13.20.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 13:20:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16016-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fIwBTq+F; spf=pass (google.com: domain of linux-kernel+bounces-16016-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16016-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5A4B91F220F6 for ; Wed, 3 Jan 2024 21:20:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0394F1D6A7; Wed, 3 Jan 2024 21:19:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fIwBTq+F" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3420F1D696; Wed, 3 Jan 2024 21:19:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BB75C433C7; Wed, 3 Jan 2024 21:19:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704316791; bh=pECIEIb28EtEOiDFQMWcUuOJdfm106t6mJYZ646MxwY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fIwBTq+Fat5ri3bGo7Y8PJD1wtV1IVfRaoQCX8PUkdWwu/aabUhBW3okHAVp/Sa34 C6BV6MTWQxSXK0Vf4VrJVol5n5QonJcO0NXCbgMgX61gFWPGlthlFO+r56GIgF+dXr JLgVnCRYXIpox7fwpWcoR46cUaYTrb97MeGbWGC/dFXgFHFdAxvq5XUhExnl+ReWZt xKaWuXtKAjlkdewIIoMuq/GqwSH9l9OvkrHZjQvkW7+ZKfIfQhgxI3OHDJrcQo7Xrt HkMGXSvTivWrwCYeWmhsbS4zGWwFaW+XXbBqjJOxp/mjIJ0c0sNRNuvuOMC7jhh3Kd ByPuu+TmZpJlA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 3133F403EF; Wed, 3 Jan 2024 18:19:49 -0300 (-03) Date: Wed, 3 Jan 2024 18:19:49 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: baomingtong001@208suo.com, peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, adrian.hunter@intel.com, anshuman.khandual@arm.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf tools:remove unneeded variable from perf_event_attr__fprintf() Message-ID: References: <20230614062234.24149-1-luojianhong@cdjrlc.com> <329a5b1b6e2c9061467ed6ef82247b8d@208suo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com Em Wed, Jul 12, 2023 at 06:20:12PM -0700, Ian Rogers escreveu: > On Tue, Jun 13, 2023 at 11:25 PM wrote: > > > > fix the following coccicheck warning: > > > > tools/perf/util/perf_event_attr_fprintf.c:97:5-8: Unneeded variable: > > "ret". Return "0". > > > > Signed-off-by: Mingtong Bao > > Acked-by: Ian Rogers util/perf_event_attr_fprintf.c: In function ‘perf_event_attr__fprintf’: util/perf_event_attr_fprintf.c:256:17: error: ‘ret’ undeclared (first use in this function) 256 | ret += attr__fprintf(fp, _n, buf, priv);\ | ^~~ util/perf_event_attr_fprintf.c:267:9: note: in expansion of macro ‘PRINT_ATTRn’ 267 | PRINT_ATTRn("type", type, p_type_id, true); | ^~~~~~~~~~~ All those PRINT_ATTRf use that ret variable: #define PRINT_ATTRn(_n, _f, _p, _a) \ do { \ if (_a || attr->_f) { \ _p(attr->_f); \ ret += attr__fprintf(fp, _n, buf, priv);\ } \ } while (0) #define PRINT_ATTRf(_f, _p) PRINT_ATTRn(#_f, _f, _p, false - Arnaldo > Thanks, > Ian > > > --- > > tools/perf/util/perf_event_attr_fprintf.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/tools/perf/util/perf_event_attr_fprintf.c > > b/tools/perf/util/perf_event_attr_fprintf.c > > index 7e5e7b30510d..4a8f625b80c7 100644 > > --- a/tools/perf/util/perf_event_attr_fprintf.c > > +++ b/tools/perf/util/perf_event_attr_fprintf.c > > @@ -94,7 +94,6 @@ int perf_event_attr__fprintf(FILE *fp, struct > > perf_event_attr *attr, > > attr__fprintf_f attr__fprintf, void *priv) > > { > > char buf[BUF_SIZE]; > > - int ret = 0; > > > > PRINT_ATTRf(type, p_unsigned); > > PRINT_ATTRf(size, p_unsigned); > > @@ -155,5 +154,5 @@ int perf_event_attr__fprintf(FILE *fp, struct > > perf_event_attr *attr, > > PRINT_ATTRf(aux_sample_size, p_unsigned); > > PRINT_ATTRf(sig_data, p_unsigned); > > > > - return ret; > > + return 0; > > } -- - Arnaldo