@@ -634,19 +634,17 @@ static int register_trace_kprobe(struct trace_kprobe *tk)
634
634
struct trace_kprobe * old_tk ;
635
635
int ret ;
636
636
637
- mutex_lock (& event_mutex );
637
+ guard ( mutex ) (& event_mutex );
638
638
639
639
old_tk = find_trace_kprobe (trace_probe_name (& tk -> tp ),
640
640
trace_probe_group_name (& tk -> tp ));
641
641
if (old_tk ) {
642
642
if (trace_kprobe_is_return (tk ) != trace_kprobe_is_return (old_tk )) {
643
643
trace_probe_log_set_index (0 );
644
644
trace_probe_log_err (0 , DIFF_PROBE_TYPE );
645
- ret = - EEXIST ;
646
- } else {
647
- ret = append_trace_kprobe (tk , old_tk );
645
+ return - EEXIST ;
648
646
}
649
- goto end ;
647
+ return append_trace_kprobe ( tk , old_tk ) ;
650
648
}
651
649
652
650
/* Register new event */
@@ -657,7 +655,7 @@ static int register_trace_kprobe(struct trace_kprobe *tk)
657
655
trace_probe_log_err (0 , EVENT_EXIST );
658
656
} else
659
657
pr_warn ("Failed to register probe event(%d)\n" , ret );
660
- goto end ;
658
+ return ret ;
661
659
}
662
660
663
661
/* Register k*probe */
@@ -672,8 +670,6 @@ static int register_trace_kprobe(struct trace_kprobe *tk)
672
670
else
673
671
dyn_event_add (& tk -> devent , trace_probe_event_call (& tk -> tp ));
674
672
675
- end :
676
- mutex_unlock (& event_mutex );
677
673
return ret ;
678
674
}
679
675
@@ -706,7 +702,7 @@ static int trace_kprobe_module_callback(struct notifier_block *nb,
706
702
return NOTIFY_DONE ;
707
703
708
704
/* Update probes on coming module */
709
- mutex_lock (& event_mutex );
705
+ guard ( mutex ) (& event_mutex );
710
706
for_each_trace_kprobe (tk , pos ) {
711
707
if (trace_kprobe_within_module (tk , mod )) {
712
708
/* Don't need to check busy - this should have gone. */
@@ -718,7 +714,6 @@ static int trace_kprobe_module_callback(struct notifier_block *nb,
718
714
module_name (mod ), ret );
719
715
}
720
716
}
721
- mutex_unlock (& event_mutex );
722
717
723
718
return NOTIFY_DONE ;
724
719
}
@@ -1970,13 +1965,12 @@ static __init void enable_boot_kprobe_events(void)
1970
1965
struct trace_kprobe * tk ;
1971
1966
struct dyn_event * pos ;
1972
1967
1973
- mutex_lock (& event_mutex );
1968
+ guard ( mutex ) (& event_mutex );
1974
1969
for_each_trace_kprobe (tk , pos ) {
1975
1970
list_for_each_entry (file , & tr -> events , list )
1976
1971
if (file -> event_call == trace_probe_event_call (& tk -> tp ))
1977
1972
trace_event_enable_disable (file , 1 , 0 );
1978
1973
}
1979
- mutex_unlock (& event_mutex );
1980
1974
}
1981
1975
1982
1976
static __init void setup_boot_kprobe_events (void )
0 commit comments