@@ -634,19 +634,17 @@ static int register_trace_kprobe(struct trace_kprobe *tk)
634634 struct trace_kprobe * old_tk ;
635635 int ret ;
636636
637- mutex_lock (& event_mutex );
637+ guard ( mutex ) (& event_mutex );
638638
639639 old_tk = find_trace_kprobe (trace_probe_name (& tk -> tp ),
640640 trace_probe_group_name (& tk -> tp ));
641641 if (old_tk ) {
642642 if (trace_kprobe_is_return (tk ) != trace_kprobe_is_return (old_tk )) {
643643 trace_probe_log_set_index (0 );
644644 trace_probe_log_err (0 , DIFF_PROBE_TYPE );
645- ret = - EEXIST ;
646- } else {
647- ret = append_trace_kprobe (tk , old_tk );
645+ return - EEXIST ;
648646 }
649- goto end ;
647+ return append_trace_kprobe ( tk , old_tk ) ;
650648 }
651649
652650 /* Register new event */
@@ -657,7 +655,7 @@ static int register_trace_kprobe(struct trace_kprobe *tk)
657655 trace_probe_log_err (0 , EVENT_EXIST );
658656 } else
659657 pr_warn ("Failed to register probe event(%d)\n" , ret );
660- goto end ;
658+ return ret ;
661659 }
662660
663661 /* Register k*probe */
@@ -672,8 +670,6 @@ static int register_trace_kprobe(struct trace_kprobe *tk)
672670 else
673671 dyn_event_add (& tk -> devent , trace_probe_event_call (& tk -> tp ));
674672
675- end :
676- mutex_unlock (& event_mutex );
677673 return ret ;
678674}
679675
@@ -706,7 +702,7 @@ static int trace_kprobe_module_callback(struct notifier_block *nb,
706702 return NOTIFY_DONE ;
707703
708704 /* Update probes on coming module */
709- mutex_lock (& event_mutex );
705+ guard ( mutex ) (& event_mutex );
710706 for_each_trace_kprobe (tk , pos ) {
711707 if (trace_kprobe_within_module (tk , mod )) {
712708 /* Don't need to check busy - this should have gone. */
@@ -718,7 +714,6 @@ static int trace_kprobe_module_callback(struct notifier_block *nb,
718714 module_name (mod ), ret );
719715 }
720716 }
721- mutex_unlock (& event_mutex );
722717
723718 return NOTIFY_DONE ;
724719}
@@ -1970,13 +1965,12 @@ static __init void enable_boot_kprobe_events(void)
19701965 struct trace_kprobe * tk ;
19711966 struct dyn_event * pos ;
19721967
1973- mutex_lock (& event_mutex );
1968+ guard ( mutex ) (& event_mutex );
19741969 for_each_trace_kprobe (tk , pos ) {
19751970 list_for_each_entry (file , & tr -> events , list )
19761971 if (file -> event_call == trace_probe_event_call (& tk -> tp ))
19771972 trace_event_enable_disable (file , 1 , 0 );
19781973 }
1979- mutex_unlock (& event_mutex );
19801974}
19811975
19821976static __init void setup_boot_kprobe_events (void )
0 commit comments