From patchwork Fri Jan 20 12:34:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 46318 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp172846wrn; Fri, 20 Jan 2023 04:36:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXvmKZaIIy9rUL/HgMofAlpOTKU/AwazESsrLyeRoI7FKD//KABPD0Raj/TxxXfwXvTRqmnx X-Received: by 2002:a05:6402:35c1:b0:46f:f36b:a471 with SMTP id z1-20020a05640235c100b0046ff36ba471mr20344156edc.22.1674218206968; Fri, 20 Jan 2023 04:36:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674218206; cv=none; d=google.com; s=arc-20160816; b=oep3O/bGJOhCXPSSMG2SwoVp1Ezj0q3p3QcJgb9xnSz6RymIXSycuEqgotvK2Y3gB5 4DafZMGARJS8hUviH0aCuDN4SjSCVok86450soNh+M9PAyQqbSXEX5/EiM6B75Xozy6V Z1nSucoCwRFaYUfFbjCFFFtICsuSpc+b58R/tWWfX+BaJnowWy9f9AHBHeXSDRHFLH/i CX/H+2ADHPmHKtDMIhnZwjpjDy+fKBfeL/DIX97bJIxyB4/kWwySPVu3wKYpNVlJGabX lweamXucZyuTtCVF0sYE7Tx/R6V0DRxcJKzHBe+5bKYDaYUBU/sMIVTSKiM9l3hCmk9A 1kwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2XObSrLPu5WzsAZHskCjh6gmu6CjTjyAX8BgvT+iG4Q=; b=d8VQMuhOkSlyJI62Br2HicNejaL0O3zWLFWROKzVF/ijrlJzYncI/1CLABcwOqYwER dSFNfMEScW6PPp2H8AH14FzlvGRSo5gg2IMgImfbgu006D5czlLO6/qDwJ5O45QN6Rgx o+w+MWLlAD0cISqGEsS/Pmq0IDOl9chYqYs1tANKgxAG1Kg6D3iclLfspm4HDEugRtBS HdiONEKltebiyYEYIPdhKg7K0eZIkykJHpbJEang26dDY/Xk/ZlSp9Jd8GPeGr8YArQu CjoHvjO0ant3UQ4KXP+2hn6KxuMQ5S/MnJY2UG39oteG1MUaX899kiEJQ86N8fm4gXCl tzYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="QnRWmb//"; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fd14-20020a056402388e00b0049ea11f77eesi2851951edb.528.2023.01.20.04.36.22; Fri, 20 Jan 2023 04:36:46 -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=@intel.com header.s=Intel header.b="QnRWmb//"; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbjATMfr (ORCPT + 99 others); Fri, 20 Jan 2023 07:35:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230180AbjATMfe (ORCPT ); Fri, 20 Jan 2023 07:35:34 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8D26BCE06; Fri, 20 Jan 2023 04:35:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674218126; x=1705754126; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UxtJ1rP66dQ3RmSMBjvuUkGyB8tVAPu0JZkPBT1WvxI=; b=QnRWmb//iRSmbXKXl/YpxMmnxA9055P/PIqAqLlpGx2CIvaYpMth528M aodCoRwBm0zLgfA7/0VLCIKZ+pHWdrCrZveC6whsSS9d2bQclf0sV31kZ Ze42hZabzfUKsNDvSwDWM2SUGflevPo5OVYgTsZF9BK8w1NeKT5n3/3st nz+RpoEgvyi8nyHm+QS4sG0tkt2tjb3MlI64NOgyWMWP+XHWZ9bgUgneL NoF3Dwjvlc8j54BlSKAdccK0MUni+HTXUMp8c8IomCOV8WIUd3RDY6sF8 VxRd0+XXrmsi07IBSvBaCg/Ixyfk0jK1plM6RngIOw5ZDGVsOdWy43fIh w==; X-IronPort-AV: E=McAfee;i="6500,9779,10595"; a="387935223" X-IronPort-AV: E=Sophos;i="5.97,232,1669104000"; d="scan'208";a="387935223" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2023 04:35:26 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10595"; a="692847438" X-IronPort-AV: E=Sophos;i="5.97,232,1669104000"; d="scan'208";a="692847438" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.251.223.163]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2023 04:35:24 -0800 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 05/10] perf symbols: Slightly simplify 'err' usage in dso__synthesize_plt_symbols() Date: Fri, 20 Jan 2023 14:34:51 +0200 Message-Id: <20230120123456.12449-6-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230120123456.12449-1-adrian.hunter@intel.com> References: <20230120123456.12449-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755545030456801944?= X-GMAIL-MSGID: =?utf-8?q?1755545030456801944?= Return zero directly instead of needless 'goto out_elf_end' that does the same thing. That allows 'err' to be initialized to -1 instead of having to change its value later. Signed-off-by: Adrian Hunter --- tools/perf/util/symbol-elf.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index c6a4e6c73990..990a2c6037bb 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -384,7 +384,7 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss) GElf_Ehdr ehdr; char sympltname[1024]; Elf *elf; - int nr = 0, symidx, err = 0; + int nr = 0, symidx, err = -1; if (!ss->dynsym) return 0; @@ -397,7 +397,7 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss) dynsym_idx = ss->dynsym_idx; if (scn_dynsym == NULL) - goto out_elf_end; + return 0; scn_plt_rel = elf_section_by_name(elf, &ehdr, &shdr_rel_plt, ".rela.plt", NULL); @@ -405,11 +405,9 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss) scn_plt_rel = elf_section_by_name(elf, &ehdr, &shdr_rel_plt, ".rel.plt", NULL); if (scn_plt_rel == NULL) - goto out_elf_end; + return 0; } - err = -1; - if (shdr_rel_plt.sh_link != dynsym_idx) goto out_elf_end;