hw-breakpoints: Simplify error handling in breakpoint creation requests

This simplifies the error handling when we create a breakpoint.
We don't need to check the NULL return value corner case anymore
since we have improved perf_event_create_kernel_counter() to
always return an error code in the failure case.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Prasad <prasad@linux.vnet.ibm.com>
LKML-Reference: <1259210142-5714-3-git-send-regression-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Frederic Weisbecker 2009-11-26 05:35:42 +01:00 committed by Ingo Molnar
parent c6567f642e
commit 605bfaee90
4 changed files with 8 additions and 25 deletions

View file

@ -442,7 +442,7 @@ register_wide_hw_breakpoint(unsigned long addr,
*pevent = bp;
if (IS_ERR(bp) || !bp) {
if (IS_ERR(bp)) {
err = PTR_ERR(bp);
goto fail;
}
@ -453,7 +453,7 @@ register_wide_hw_breakpoint(unsigned long addr,
fail:
for_each_possible_cpu(cpu) {
pevent = per_cpu_ptr(cpu_events, cpu);
if (IS_ERR(*pevent) || !*pevent)
if (IS_ERR(*pevent))
break;
unregister_hw_breakpoint(*pevent);
}