aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-11-25 23:35:42 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-26 03:29:21 -0500
commit605bfaee9078cd0b01d83402315389839ee4bb5c (patch)
tree35c3af269b37347b689b3b212fc99d4ae9f719e5 /kernel
parentc6567f642e20bcc79abed030f44be5b0d6da2ded (diff)
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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/hw_breakpoint.c4
-rw-r--r--kernel/trace/trace_ksym.c16
2 files changed, 6 insertions, 14 deletions
diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
index 06d372fc026d..dd3fb4a999d3 100644
--- a/kernel/hw_breakpoint.c
+++ b/kernel/hw_breakpoint.c
@@ -442,7 +442,7 @@ register_wide_hw_breakpoint(unsigned long addr,
442 442
443 *pevent = bp; 443 *pevent = bp;
444 444
445 if (IS_ERR(bp) || !bp) { 445 if (IS_ERR(bp)) {
446 err = PTR_ERR(bp); 446 err = PTR_ERR(bp);
447 goto fail; 447 goto fail;
448 } 448 }
@@ -453,7 +453,7 @@ register_wide_hw_breakpoint(unsigned long addr,
453fail: 453fail:
454 for_each_possible_cpu(cpu) { 454 for_each_possible_cpu(cpu) {
455 pevent = per_cpu_ptr(cpu_events, cpu); 455 pevent = per_cpu_ptr(cpu_events, cpu);
456 if (IS_ERR(*pevent) || !*pevent) 456 if (IS_ERR(*pevent))
457 break; 457 break;
458 unregister_hw_breakpoint(*pevent); 458 unregister_hw_breakpoint(*pevent);
459 } 459 }
diff --git a/kernel/trace/trace_ksym.c b/kernel/trace/trace_ksym.c
index 9f040e42f516..c538b15b95d6 100644
--- a/kernel/trace/trace_ksym.c
+++ b/kernel/trace/trace_ksym.c
@@ -200,12 +200,9 @@ int process_new_ksym_entry(char *ksymname, int op, unsigned long addr)
200 entry->ksym_hbp = register_wide_hw_breakpoint(entry->ksym_addr, 200 entry->ksym_hbp = register_wide_hw_breakpoint(entry->ksym_addr,
201 entry->len, entry->type, 201 entry->len, entry->type,
202 ksym_hbp_handler, true); 202 ksym_hbp_handler, true);
203
203 if (IS_ERR(entry->ksym_hbp)) { 204 if (IS_ERR(entry->ksym_hbp)) {
204 entry->ksym_hbp = NULL;
205 ret = PTR_ERR(entry->ksym_hbp); 205 ret = PTR_ERR(entry->ksym_hbp);
206 }
207
208 if (!entry->ksym_hbp) {
209 printk(KERN_INFO "ksym_tracer request failed. Try again" 206 printk(KERN_INFO "ksym_tracer request failed. Try again"
210 " later!!\n"); 207 " later!!\n");
211 goto err; 208 goto err;
@@ -332,21 +329,16 @@ static ssize_t ksym_trace_filter_write(struct file *file,
332 if (changed) { 329 if (changed) {
333 unregister_wide_hw_breakpoint(entry->ksym_hbp); 330 unregister_wide_hw_breakpoint(entry->ksym_hbp);
334 entry->type = op; 331 entry->type = op;
332 ret = 0;
335 if (op > 0) { 333 if (op > 0) {
336 entry->ksym_hbp = 334 entry->ksym_hbp =
337 register_wide_hw_breakpoint(entry->ksym_addr, 335 register_wide_hw_breakpoint(entry->ksym_addr,
338 entry->len, entry->type, 336 entry->len, entry->type,
339 ksym_hbp_handler, true); 337 ksym_hbp_handler, true);
340 if (IS_ERR(entry->ksym_hbp)) 338 if (IS_ERR(entry->ksym_hbp))
341 entry->ksym_hbp = NULL; 339 ret = PTR_ERR(entry->ksym_hbp);
342 340 else
343 /* modified without problem */
344 if (entry->ksym_hbp) {
345 ret = 0;
346 goto out; 341 goto out;
347 }
348 } else {
349 ret = 0;
350 } 342 }
351 /* Error or "symbol:---" case: drop it */ 343 /* Error or "symbol:---" case: drop it */
352 ksym_filter_entry_count--; 344 ksym_filter_entry_count--;