This patch fixes uninitialized variables to remove remaining compiler warnings as follows:
event-parse.c: In function ‘pevent_find_event_by_name’: event-parse.c:3513:21: warning: ‘event’ may be used uninitialized in this function [-Wmaybe-uninitialized] pevent->last_event = event; ^ event-parse.c: In function ‘pevent_data_lat_fmt’: event-parse.c:5156:20: warning: ‘migrate_disable’ may be used uninitialized in this function [-Wmaybe-uninitialized] trace_seq_printf(s, "%d", migrate_disable); ^ event-parse.c:5163:20: warning: ‘lock_depth’ may be used uninitialized in this function [-Wmaybe-uninitialized] trace_seq_printf(s, "%d", lock_depth); ^ event-parse.c: In function ‘pevent_event_info’: event-parse.c:5060:18: warning: ‘len_arg’ may be used uninitialized in this function [-Wmaybe-uninitialized] print_str_arg(&p, data, size, event, ^ event-parse.c:4846:6: note: ‘len_arg’ was declared here int len_arg; ^ ... kbuffer-parse.c: In function ‘__old_next_event’: kbuffer-parse.c:339:27: warning: ‘length’ may be used uninitialized in this function [-Wmaybe-uninitialized] kbuf->next = kbuf->index + length; ^ kbuffer-parse.c:297:15: note: ‘length’ was declared here unsigned int length; ^ Signed-off-by: Honggyu Kim <hong.gyu....@lge.com> --- tools/lib/traceevent/event-parse.c | 8 ++++---- tools/lib/traceevent/kbuffer-parse.c | 2 +- tools/lib/traceevent/plugin_function.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 664c90c..2fb9338 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -3490,7 +3490,7 @@ struct event_format * pevent_find_event_by_name(struct pevent *pevent, const char *sys, const char *name) { - struct event_format *event; + struct event_format *event = NULL; int i; if (pevent->last_event && @@ -4843,7 +4843,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event char format[32]; int show_func; int len_as_arg; - int len_arg; + int len_arg = 0; int len; int ls; @@ -5102,8 +5102,8 @@ void pevent_data_lat_fmt(struct pevent *pevent, static int migrate_disable_exists; unsigned int lat_flags; unsigned int pc; - int lock_depth; - int migrate_disable; + int lock_depth = -1; + int migrate_disable = 0; int hardirq; int softirq; void *data = record->data; diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c index 65984f1..fc8f20c 100644 --- a/tools/lib/traceevent/kbuffer-parse.c +++ b/tools/lib/traceevent/kbuffer-parse.c @@ -294,7 +294,7 @@ static unsigned int old_update_pointers(struct kbuffer *kbuf) unsigned int type; unsigned int len; unsigned int delta; - unsigned int length; + unsigned int length = 0; void *ptr = kbuf->data + kbuf->curr; type_len_ts = read_4(kbuf, ptr); diff --git a/tools/lib/traceevent/plugin_function.c b/tools/lib/traceevent/plugin_function.c index a00ec19..42dbf73 100644 --- a/tools/lib/traceevent/plugin_function.c +++ b/tools/lib/traceevent/plugin_function.c @@ -130,7 +130,7 @@ static int function_handler(struct trace_seq *s, struct pevent_record *record, unsigned long long pfunction; const char *func; const char *parent; - int index; + int index = 0; if (pevent_get_field_val(s, event, "ip", record, &function, 1)) return trace_seq_putc(s, '!'); -- 2.10.0.rc2.dirty