From: Adrian Hunter Date: Wed, 16 Jul 2014 07:19:43 +0000 (+0300) Subject: perf thread: Allow deletion of a thread with no map groups X-Git-Tag: v3.17-rc1~135^2~5^2~7 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9608b84e4dd95341b88cad646b114811f5bccbba;p=karo-tx-linux.git perf thread: Allow deletion of a thread with no map groups 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 Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1405495184-20441-2-git-send-email-adrian.hunter@intel.com Signed-off-by: Adrian Hunter Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 7a32f447a8e7..b9c36ef42d2f 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -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);