]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
perf_counter: Fix return value from dummy hw_perf_counter_init
authorPaul Mackerras <paulus@samba.org>
Fri, 9 Jan 2009 05:19:25 +0000 (16:19 +1100)
committerPaul Mackerras <paulus@samba.org>
Fri, 9 Jan 2009 05:19:25 +0000 (16:19 +1100)
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>
kernel/perf_counter.c

index 37f771691f938b84eaa9126fc6f387d9a9356424..4be1a8d872b43b8e588cc5b69d6986669ecb2657 100644 (file)
@@ -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; }