From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759355AbcAUKnj (ORCPT ); Thu, 21 Jan 2016 05:43:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40691 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759031AbcAUKne (ORCPT ); Thu, 21 Jan 2016 05:43:34 -0500 Date: Thu, 21 Jan 2016 11:43:30 +0100 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Stephane Eranian , Andi Kleen , Wang Nan Subject: Re: [PATCH 01/17] perf hists: Basic support of hierarchical report view Message-ID: <20160121104330.GD13547@krava.brq.redhat.com> References: <1452960197-5323-1-git-send-email-namhyung@kernel.org> <1452960197-5323-2-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1452960197-5323-2-git-send-email-namhyung@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 17, 2016 at 01:03:01AM +0900, Namhyung Kim wrote: SNIP > +} > + > +static bool hists__hierarchy_insert_entry(struct hists *hists, > + struct rb_root *root, > + struct hist_entry *he) > +{ > + struct perf_hpp_fmt *fmt; > + struct hist_entry *new = NULL; > + struct hist_entry *parent = NULL; > + int depth = 0; > + > + perf_hpp__for_each_sort_list(fmt) { > + if (!perf_hpp__is_sort_entry(fmt) && > + !perf_hpp__is_dynamic_entry(fmt)) > + continue; > + > + /* insert copy of 'he' for each fmt into the hierarchy */ > + new = hierarchy_insert_entry(hists, root, he, fmt); > + if (new == NULL) > + break; so hierarchy_insert_entry can fail because of memory allocation but the resort path does not cover any error path because it only shuffles entries from in-tree into sorted tree would it make more sense to do this in 'in-tree addition' path? and keep the resort functions to do only resort stuff thanks, jirka