From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752402AbeBHNy4 (ORCPT ); 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 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) Sender: linux-kernel-owner@vger.kernel.org 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