diff options
author | Paul Mackerras <paulus@samba.org> | 2009-01-09 16:19:25 +1100 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2009-01-09 16:19:25 +1100 |
commit | ff6f05416ece2caec1a7a1f8180d6598e0ab9272 (patch) | |
tree | 31ab967c5da814cc27dc0d9f8514f3af5dcd49ac /kernel/perf_counter.c | |
parent | e1df957670aef74ffd9a4ad93e6d2c90bf6b4845 (diff) | |
download | lwn-ff6f05416ece2caec1a7a1f8180d6598e0ab9272.tar.gz lwn-ff6f05416ece2caec1a7a1f8180d6598e0ab9272.zip |
perf_counter: Fix return value from dummy hw_perf_counter_init
Impact: fix oops-causing bug
Currently, if you try to use perf_counters on an architecture that has
no hardware support, and you select an event that doesn't map to any of
the defined software counters, you get an oops rather than an error.
This is because the dummy hw_perf_counter_init returns ERR_PTR(-EINVAL)
but the caller (perf_counter_alloc) only tests for NULL.
This makes the dummy hw_perf_counter_init return NULL instead.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r-- | kernel/perf_counter.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 37f771691f93..4be1a8d872b4 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c @@ -41,7 +41,7 @@ static DEFINE_MUTEX(perf_resource_mutex); extern __weak const struct hw_perf_counter_ops * hw_perf_counter_init(struct perf_counter *counter) { - return ERR_PTR(-EINVAL); + return NULL; } u64 __weak hw_perf_save_disable(void) { return 0; } |