]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
perf thread: Allow deletion of a thread with no map groups
authorAdrian Hunter <adrian.hunter@intel.com>
Wed, 16 Jul 2014 07:19:43 +0000 (10:19 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 17 Jul 2014 13:32:35 +0000 (10:32 -0300)
It needs to be possible to call thread__delete() on a thread with no map
groups.

This is needed for a subsequent patch which deletes a thread on the
error path before map groups have been attached.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1405495184-20441-2-git-send-email-adrian.hunter@intel.com
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/thread.c

index 7a32f447a8e78937863ff66da6f4e0f0e1fd6b3f..b9c36ef42d2fa2248bb1d54d88a727b8d77176dd 100644 (file)
@@ -60,8 +60,10 @@ void thread__delete(struct thread *thread)
 {
        struct comm *comm, *tmp;
 
-       map_groups__put(thread->mg);
-       thread->mg = NULL;
+       if (thread->mg) {
+               map_groups__put(thread->mg);
+               thread->mg = NULL;
+       }
        list_for_each_entry_safe(comm, tmp, &thread->comm_list, list) {
                list_del(&comm->list);
                comm__free(comm);