On 2016/6/22 21:40, Arnaldo Carvalho de Melo wrote:
Em Wed, Jun 22, 2016 at 08:17:02AM -0500, Nilay Vaish escreveu:
On 22 June 2016 at 04:08, Wang Nan <wangn...@huawei.com> wrote:
+struct perf_evlist *perf_evlist__new_aux(struct perf_evlist *parent)
+{
+       struct perf_evlist *evlist;
+
+       if (perf_evlist__is_aux(parent)) {
+               pr_err("Internal error: create aux evlist from another aux 
evlist\n");
+               return NULL;
+       }
+
+       evlist = zalloc(sizeof(*evlist));
+       if (!evlist)
+               return NULL;
+
+       perf_evlist__init(evlist, parent->cpus, parent->threads);
+       evlist->parent = parent->parent;
A very minor suggestion.  I think evlist->parent  should be set to
'parent' and not 'parent->parent'.  I agree the two values are equal,
but setting to parent->parent just does not seem right.
I felt like that, thought I was missing something, which is always a bad
feeling when processing a patch... So, Wang, does that have some value
we are not seeing?

I thought about the possibility of adding an aux2 to an aux1 evlist and
that making aux2 have the same parent as aux1, but that is checked on
that pr_err() test...

The pr_err() test is added yesterday to emphasize we don't accept
grandchildren. Before we have this test, setting parent to parent->parent
is a defensive programming. And I think it is clever :)

Thank you.

Reply via email to