[tip:perf/core] perf events: Fix false positive build warning with older GCC's

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: tip-bot for Ingo Molnar
Date: Thursday, March 18, 2010 - 10:38 am

Commit-ID:  55632770d7298835645489828af87f854c47749c
Gitweb:     http://git.kernel.org/tip/55632770d7298835645489828af87f854c47749c
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 18 Mar 2010 16:51:16 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 18 Mar 2010 17:03:24 +0100

perf events: Fix false positive build warning with older GCC's

gcc 4.2.1 produces:

 util/probe-event.c: In function 'add_perf_probe_events':
 util/probe-event.c:883: warning: 'tev' may be used uninitialized in this function
 make: *** [util/probe-event.o] Error 1

Newer GCCs get this right.

To work it around, initialize the variable to NULL so that older GCCs see
it as initialized too.

Cc: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20100316220612.32050.33806.stgit@localhost6.localdomain6>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/util/probe-event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index f333269..c6603f3 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -880,7 +880,7 @@ static void __add_kprobe_trace_events(struct perf_probe_event *pev,
 				      int ntevs, bool allow_suffix)
 {
 	int i, fd;
-	struct kprobe_trace_event *tev;
+	struct kprobe_trace_event *tev = NULL;
 	char buf[64];
 	const char *event, *group;
 	struct strlist *namelist;
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -tip 04/10] perf probe: Rename session to param, Masami Hiramatsu, (Tue Mar 16, 3:05 pm)
[PATCH -tip 06/10] perf probe: Introduce die_find_child() ..., Masami Hiramatsu, (Tue Mar 16, 3:05 pm)
[PATCH -tip 07/10] perf probe: Add --dry-run option, Masami Hiramatsu, (Tue Mar 16, 3:06 pm)
[tip:perf/core] perf tools: Introduce xzalloc() for detect ..., tip-bot for Masami H ..., (Wed Mar 17, 4:27 am)
[tip:perf/core] perf probe: Move add-probe routine to util/, tip-bot for Masami H ..., (Wed Mar 17, 4:28 am)
[tip:perf/core] perf probe: Rename session to param, tip-bot for Masami H ..., (Wed Mar 17, 4:28 am)
[tip:perf/core] perf probe: Rename some die_get_* functions, tip-bot for Masami H ..., (Wed Mar 17, 4:28 am)
[tip:perf/core] perf probe: Introduce die_find_child() fun ..., tip-bot for Masami H ..., (Wed Mar 17, 4:29 am)
[tip:perf/core] perf probe: Add --dry-run option, tip-bot for Masami H ..., (Wed Mar 17, 4:29 am)
[tip:perf/core] perf probe: Introduce kprobe_trace_event a ..., tip-bot for Masami H ..., (Wed Mar 17, 4:29 am)
[tip:perf/core] perf probe: List probes with line number a ..., tip-bot for Masami H ..., (Wed Mar 17, 4:29 am)
[tip:perf/core] perf probe: Add data structure member acce ..., tip-bot for Masami H ..., (Wed Mar 17, 4:30 am)
[tip:perf/core] perf probe: Fix !dwarf build, tip-bot for Ingo Molnar, (Wed Mar 17, 4:30 am)
Re: [tip:perf/core] perf probe: Fix !dwarf build, Masami Hiramatsu, (Wed Mar 17, 7:14 am)
Re: [PATCH -tip 10/10] perf probe: Accessing members in da ..., Masami Hiramatsu, (Wed Mar 17, 12:14 pm)
Re: [PATCH -tip 10/10] perf probe: Accessing members in da ..., Frederic Weisbecker, (Wed Mar 17, 8:28 pm)
[tip:perf/core] perf events: Fix false positive build warn ..., tip-bot for Ingo Molnar, (Thu Mar 18, 10:38 am)
Re: [tip:perf/core] perf events: Fix false positive build ..., Masami Hiramatsu, (Thu Mar 18, 1:03 pm)
Re: [PATCH -tip 10/10] perf probe: Accessing members in da ..., Arnaldo Carvalho de Melo, (Tue Mar 23, 9:27 am)