diff options
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 64a018e94fca..821ce8221974 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -6098,17 +6098,22 @@ struct pmu *perf_init_event(struct perf_event *event) | |||
6098 | { | 6098 | { |
6099 | struct pmu *pmu = NULL; | 6099 | struct pmu *pmu = NULL; |
6100 | int idx; | 6100 | int idx; |
6101 | int ret; | ||
6101 | 6102 | ||
6102 | idx = srcu_read_lock(&pmus_srcu); | 6103 | idx = srcu_read_lock(&pmus_srcu); |
6103 | 6104 | ||
6104 | rcu_read_lock(); | 6105 | rcu_read_lock(); |
6105 | pmu = idr_find(&pmu_idr, event->attr.type); | 6106 | pmu = idr_find(&pmu_idr, event->attr.type); |
6106 | rcu_read_unlock(); | 6107 | rcu_read_unlock(); |
6107 | if (pmu) | 6108 | if (pmu) { |
6109 | ret = pmu->event_init(event); | ||
6110 | if (ret) | ||
6111 | pmu = ERR_PTR(ret); | ||
6108 | goto unlock; | 6112 | goto unlock; |
6113 | } | ||
6109 | 6114 | ||
6110 | list_for_each_entry_rcu(pmu, &pmus, entry) { | 6115 | list_for_each_entry_rcu(pmu, &pmus, entry) { |
6111 | int ret = pmu->event_init(event); | 6116 | ret = pmu->event_init(event); |
6112 | if (!ret) | 6117 | if (!ret) |
6113 | goto unlock; | 6118 | goto unlock; |
6114 | 6119 | ||