Skip to contentSkip to conversation

perf: Fix perf probe build error

PATCH In review Frederic Weisbecker 2 participants 2 messages Apr 21, 2010 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: Fix perf probe build error

When we run into dry run mode, we want to make write_kprobe_trace_event to succeed on writing the event. Let's initialize it to 0.

Fixes the following build error:
util/probe-event.c:1266: attention : «ret» may be used uninitialized in this function util/probe-event.c:1266: note: «ret» was declared here

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
---
 tools/perf/util/probe-event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/probe-event.c +1 -1
index 3967f8f..4fb4803 100644
@@ -1263,7 +1263,7 @@ static struct strlist *get_kprobe_trace_event_names(int fd, bool include_group)
 
 static int write_kprobe_trace_event(int fd, struct kprobe_trace_event *tev)
 {
-	int ret;
+	int ret = 0;
 	char *buf = synthesize_kprobe_trace_command(tev);
 
 	if (!buf) {
Signature · 1 line
1.6.2.3
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Frederic Weisbecker

When we run into dry run mode, we want to make write_kprobe_trace_event to succeed on writing the event. Let's initialize it to 0.

Fixes the following build error:
util/probe-event.c:1266: attention : «ret» may be used uninitialized in this function util/probe-event.c:1266: note: «ret» was declared here

Quoted 6 lines
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>

Thanks! that's what I've found today...

Quoted 17 lines
---
 tools/perf/util/probe-event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/probe-event.c +1 -1
index 3967f8f..4fb4803 100644
@@ -1263,7 +1263,7 @@ static struct strlist *get_kprobe_trace_event_names(int fd, bool include_group)
 
 static int write_kprobe_trace_event(int fd, struct kprobe_trace_event *tev)
 {
-	int ret;
+	int ret = 0;
 	char *buf = synthesize_kprobe_trace_command(tev);
 
 	if (!buf) {
Signature · 2 lines
Masami Hiramatsu
e-mail: [email protected]