Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp939617pxb; Wed, 16 Feb 2022 07:35:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxkQYn6IRAf9nl3S8X/MZ6UaGoUdp76DMmRWcy+j0TXAKyNakKWAwwxslcXpXrN7ST1eWJI X-Received: by 2002:a17:90a:581:b0:1b9:b85e:94df with SMTP id i1-20020a17090a058100b001b9b85e94dfmr2358137pji.195.1645025720174; Wed, 16 Feb 2022 07:35:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645025720; cv=none; d=google.com; s=arc-20160816; b=pBZYZzvfPqqgJQog9z/1ZlTS8qAubh6oKaSQB3r5/QinfOG6kUWzbRzqtX3vPu0V9l JMe6CeHkLVKsnQ6HMIXkIxhueZQaMTcECnmfBHtHgMTkhc6E1i13ggVH8LdtgN8apJK5 SMs0JmZUwKU3k4QH7R4HCY3Fm0DmBCmHVlnxBnHKFOeLgnW5zCqTDVSGl1aG65QCOqer oSqN2HkysUHUNI0+HG8zM7bniinJTOFiOoETSUuIwZV/ueWG15NmMppTawlzigJZSAZM L+3WF8s2gnGpgRs7VA/3O18oIdv2vojLSamy9hwMU/G4LGpvCy+ufip9ruwsiU/WcvkY nq1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zrgNlfgIaZLRUbwpSa8nvy6YZIf848hoSsdebM36YOw=; b=y6huBrPpTy6W0R4Uy7jdB5X0wCK9v1+pz7X6GJkHp3RfXFImul+2YrOjlVeHgiGzz9 Cc5s1Qnb4NHwiQ/Z1Fa3wFfAR2+5fFImEKC2miIdUYvHYj7MOYW/MThk2bhsUnhZOMfR vBF1mcNjtuh6RG0/78H6JmOr6/+npuuZ9FxmihYwklmi3DhNJkHHm/bqVD/GUY+qgw4N 8hgz/K9xxj8WjbDQxWmYVwdsmqNCZpXmT3qvYkSsBGMHNVrFJr0SnGEVcQuV+yHjJfIh Kip9YwYIT74V19sPIvtK9Mbj9OWURUx8A3VAFAP7b1w/pCP/GSFo6L+d62dMETApjodY zlZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cha2GYyt; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 2si11895809pfo.21.2022.02.16.07.35.04; Wed, 16 Feb 2022 07:35:20 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=Cha2GYyt; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234155AbiBPNjA (ORCPT + 99 others); Wed, 16 Feb 2022 08:39:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231341AbiBPNi7 (ORCPT ); Wed, 16 Feb 2022 08:38:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA78F2A39D3; Wed, 16 Feb 2022 05:38:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4779F617AA; Wed, 16 Feb 2022 13:38:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83B0DC004E1; Wed, 16 Feb 2022 13:38:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645018726; bh=lGZYCEXOcR02XYggRTWM1b9CDKi7VMUH72BM91/hGls=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Cha2GYyt/bfElVjonGLrtpt5ooygJ/bLDXKzEjBRkIwqcCLhCBHLgnSPhJGhsTJ/B CvvlYOafarNHZKswdOj6WgDCbu8kcuS6wid9R2znnNvdlbDeIQRwEhQ2yrFDVVZFd6 PULSt7pEaRph174ZmAbvf3x9UzxbbEUfL5vAFNG3Gmvd1R7AQDDwahCoL/tWd7h2T3 zSitWue2Njdx9UqQ2aI1N2I4FvF421uPlrGB0tkpJcASNoxRNWExcI7nxclfjIcojP V2MQ6zfFmtaUbcJKbAUpCbyHdf7DZp2eT1ZOmG1WNp9R3mqpFB2QO6y8bCly6dJc+G wneAnckFQpIDQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id E7E09400FE; Wed, 16 Feb 2022 10:38:43 -0300 (-03) Date: Wed, 16 Feb 2022 10:38:43 -0300 From: Arnaldo Carvalho de Melo To: tangmeng Cc: peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] perf tools: Remove redundant err variable Message-ID: References: <20220216030425.27779-1-tangmeng@uniontech.com> <20220216030425.27779-2-tangmeng@uniontech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220216030425.27779-2-tangmeng@uniontech.com> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Em Wed, Feb 16, 2022 at 11:04:25AM +0800, tangmeng escreveu: > The variable err in the perf_event__process_sample is only used > in the only one judgment statement, it is not used in other places. > > So, use the return value from hist_entry_iter__add() directly > instead of taking this in another redundant variable. Thanks, applied. - Arnaldo > Signed-off-by: tangmeng > --- > tools/perf/builtin-top.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c > index 1fc390f136dd..3c8c60b7f6f0 100644 > --- a/tools/perf/builtin-top.c > +++ b/tools/perf/builtin-top.c > @@ -746,7 +746,6 @@ static void perf_event__process_sample(struct perf_tool *tool, > { > struct perf_top *top = container_of(tool, struct perf_top, tool); > struct addr_location al; > - int err; > > if (!machine && perf_guest) { > static struct intlist *seen; > @@ -839,8 +838,7 @@ static void perf_event__process_sample(struct perf_tool *tool, > > pthread_mutex_lock(&hists->lock); > > - err = hist_entry_iter__add(&iter, &al, top->max_stack, top); > - if (err < 0) > + if (hist_entry_iter__add(&iter, &al, top->max_stack, top) < 0) > pr_err("Problem incrementing symbol period, skipping event\n"); > > pthread_mutex_unlock(&hists->lock); > -- > 2.20.1 > > -- - Arnaldo