hw-breakpoints: Simplify error handling in breakpoint creation requests
[linux-2.6.git] / kernel / trace / trace_ksym.c
index 9f040e4..c538b15 100644 (file)
@@ -200,12 +200,9 @@ int process_new_ksym_entry(char *ksymname, int op, unsigned long addr)
        entry->ksym_hbp = register_wide_hw_breakpoint(entry->ksym_addr,
                                        entry->len, entry->type,
                                        ksym_hbp_handler, true);
+
        if (IS_ERR(entry->ksym_hbp)) {
-               entry->ksym_hbp = NULL;
                ret = PTR_ERR(entry->ksym_hbp);
-       }
-
-       if (!entry->ksym_hbp) {
                printk(KERN_INFO "ksym_tracer request failed. Try again"
                                        " later!!\n");
                goto err;
@@ -332,21 +329,16 @@ static ssize_t ksym_trace_filter_write(struct file *file,
        if (changed) {
                unregister_wide_hw_breakpoint(entry->ksym_hbp);
                entry->type = op;
+               ret = 0;
                if (op > 0) {
                        entry->ksym_hbp =
                                register_wide_hw_breakpoint(entry->ksym_addr,
                                        entry->len, entry->type,
                                        ksym_hbp_handler, true);
                        if (IS_ERR(entry->ksym_hbp))
-                               entry->ksym_hbp = NULL;
-
-                       /* modified without problem */
-                       if (entry->ksym_hbp) {
-                               ret = 0;
+                               ret = PTR_ERR(entry->ksym_hbp);
+                       else
                                goto out;
-                       }
-               } else {
-                       ret = 0;
                }
                /* Error or "symbol:---" case: drop it */
                ksym_filter_entry_count--;