Received: by 10.223.176.5 with SMTP id f5csp1930321wra; Thu, 8 Feb 2018 05:57:19 -0800 (PST) X-Google-Smtp-Source: AH8x226/v0meoGh2YRMRA7obBc3QjDhAc5TkJAWIVBeDJ1u7QJdTFcQMFLoW9ZUFobSZYJRYybLZ X-Received: by 2002:a17:902:4:: with SMTP id 4-v6mr708455pla.187.1518098239836; Thu, 08 Feb 2018 05:57:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518098239; cv=none; d=google.com; s=arc-20160816; b=k//FeCFMcVkb1PW9iEYsLFUW+NQEgWcg/4XfGKuQOza5cQQ/Vfcn//vc5QFcceiOU7 SaEFH1onM3Rne7jpvZXwjhk802ffCk2UfOAe5YBRcEqb1L2WTjqNx4tyj+ShnnpKQhxu +X8h/pkhsTD+M5Mv5PhKQn4BbTncYKQygcqIRBojVdhBITvNXoHd091th1iIZoQB8SMv ahoDgL61Q8Jv2+np7b8om3lWiG4rWhi9uOS/7WfjEJi+jPd2E9oxecu2x15GLuCjKqYm dYtVeZXhX203w5fUKbtO26T593W+bTpEuEhtlTVBAARp1Qfyt/JeWZOmWvkhXxwlRcQV AkdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=PKyDOfPlHaN1gQev42fcBBSRBjMAyD6S2SVfqm13gxA=; b=BuYzX6AjnV2JC8Bq7rWYopjSZThDQFP5YFd5NBy8KHl9tRKn1JtPwnXNLq/dGbXUc/ w88ynIvoJfnLU2hcgkoylpSbktvdc7VRNJlbTv1CHhOkgtnrRbGBsyu0clovbLAWgvlv o4qUEvChffld3b7qrHQs/qv6I6dv+e4UI2nrhbELkpmVObUw09Klm/YbZLf4o95e+nWA TaI+sFy+MsEDGDwKQ+63wWpqN5sBrv06T8oyudbS0fMTLgZnJjnrbMf8K7ozPUqyfyB7 Y87YRg6c6JGnO/BN+fEXsi07U0+v1SbXhiu3z0Bq9w7AeCVqOMCBnDvKDaMB0k6p0aMY ELrg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si2403234pgd.694.2018.02.08.05.57.06; Thu, 08 Feb 2018 05:57:19 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752396AbeBHNy4 (ORCPT + 99 others); Thu, 8 Feb 2018 08:54:56 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55892 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752373AbeBHNyy (ORCPT ); Thu, 8 Feb 2018 08:54:54 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 73BED7C6BA; Thu, 8 Feb 2018 13:54:54 +0000 (UTC) Received: from krava (unknown [10.43.17.63]) by smtp.corp.redhat.com (Postfix) with SMTP id 934642026609; Thu, 8 Feb 2018 13:54:52 +0000 (UTC) Date: Thu, 8 Feb 2018 14:54:52 +0100 From: Jiri Olsa To: John Garry Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, namhyung@kernel.org, ak@linux.intel.com, wcohen@redhat.com, will.deacon@arm.com, ganapatrao.kulkarni@cavium.com, linux-kernel@vger.kernel.org, linuxarm@huawei.com, zhangshaokun@hisilicon.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 5/9] perf utils: add support for arch standard events Message-ID: <20180208135452.GE10234@krava> References: <1517939104-230881-1-git-send-email-john.garry@huawei.com> <1517939104-230881-6-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1517939104-230881-6-git-send-email-john.garry@huawei.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 08 Feb 2018 13:54:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 08 Feb 2018 13:54:54 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 07, 2018 at 01:45:00AM +0800, John Garry wrote: SNIP > + rc = nftw(ldirname, preprocess_arch_std_files, get_maxfds(), 0); > + if (rc && verbose) { > + pr_info("%s: Error preprocessing arch standard files %s\n", > + prog, ldirname); > + goto empty_map; > + } else if (rc < 0) { > + /* Make build fail */ > + return 1; > + } > rc = nftw(ldirname, process_one_file, maxfds, 0); > if (rc && verbose) { > pr_info("%s: Error walking file tree %s\n", prog, ldirname); > - goto empty_map; > + goto free_standard_arch_events; > } else if (rc < 0) { > /* Make build fail */ > return 1; > - } else if (rc) { > - goto empty_map; > } > > + /* Free memories for architecture standard events */ > + list_for_each_entry_safe(es1, es2, &arch_std_events, list) > + free(es1); > + > if (close_table) > print_events_table_suffix(eventsfp); > > @@ -1011,6 +1173,9 @@ int main(int argc, char *argv[]) > > return 0; > > +free_standard_arch_events: > + list_for_each_entry_safe(es1, es2, &arch_std_events, list) > + free(es1); that could go into a function and be used also above thanks, jirka