path: root/kernel
diff options
authorAlexander Shishkin <>2016-06-07 15:44:15 +0300
committerIngo Molnar <>2016-06-08 14:30:01 +0200
commit62a92c8f553e49270a0ee391b8733da71ab0aebc (patch)
tree17bec040a63d2e20a8e245b970d5188bf682e445 /kernel
parent3b94a891667c30fb4624221497d77fc65d950345 (diff)
perf/core: Remove a redundant check
There is no way to end up in _free_event() with event::pmu being NULL. The latter is initialized in event allocation path and remains set forever. In case of allocation failure, the error path doesn't use _free_event(). Having the check, however, suggests that it is possible to have a event::pmu==NULL situation in _free_event() and confuses the robots. This patch gets rid of the check. Reported-by: Dan Carpenter <> Signed-off-by: Alexander Shishkin <> Signed-off-by: Peter Zijlstra (Intel) <> Cc: Arnaldo Carvalho de Melo <> Cc: Linus Torvalds <> Cc: Peter Zijlstra <> Cc: Thomas Gleixner <> Cc: Cc: Link: Signed-off-by: Ingo Molnar <>
Diffstat (limited to 'kernel')
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 050a290c72c7..87e945d6ebb8 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3862,10 +3862,8 @@ static void _free_event(struct perf_event *event)
if (event->ctx)
- if (event->pmu) {
- exclusive_event_destroy(event);
- module_put(event->pmu->module);
- }
+ exclusive_event_destroy(event);
+ module_put(event->pmu->module);
call_rcu(&event->rcu_head, free_event_rcu);