perf_counter: Work around gcc warning by initializing tracepoint record unconditionally
commit10b8e3066066708f304e0fc5cfe658e05abf943d
authorFrederic Weisbecker <fweisbec@gmail.com>
Sat, 8 Aug 2009 02:26:35 +0000 (8 04:26 +0200)
committerIngo Molnar <mingo@elte.hu>
Sun, 9 Aug 2009 10:54:44 +0000 (9 12:54 +0200)
tree1ccebafe8ae44f6f032f993c63eb58a6c2aadea4
parent25446036cbfc2c89faacdb4fb4603943d2197dc6
perf_counter: Work around gcc warning by initializing tracepoint record unconditionally

Despite that the tracepoint record is always present when the
PERF_SAMPLE_TP_RECORD flag is set, gcc raises a warning,
thinking it might not be initialized:

  kernel/perf_counter.c: In function ‘perf_counter_output’:
  kernel/perf_counter.c:2650: warning: ‘tp’ may be used uninitialized in this function

Then, initialize it to NULL and always check if it's not NULL
before dereference it.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1249698400-5441-2-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/perf_counter.c