Skip to content

Commit

Permalink
perf_counter: Fix return value from dummy hw_perf_counter_init
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Mackerras committed Jan 9, 2009
1 parent e1df957 commit ff6f054
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit ff6f054

Please sign in to comment.