From e2b465757cadd72353b3ce4ae2b9402d66750e3b Mon Sep 17 00:00:00 2001 From: David Goulet Date: Fri, 11 Feb 2011 16:16:11 -0500 Subject: [PATCH] UST-wide warning fixes Signed-off-by: David Goulet Signed-off-by: Mathieu Desnoyers --- libust/buffers.c | 4 ++++ libust/trace_event.c | 2 +- libust/tracectl.c | 2 +- libustconsumer/libustconsumer.c | 3 ++- snprintf/vfprintf.c | 2 +- tests/register_test/register_test.c | 2 +- tests/tap.c | 2 +- 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libust/buffers.c b/libust/buffers.c index 2e6a161..4e8004c 100644 --- a/libust/buffers.c +++ b/libust/buffers.c @@ -1243,6 +1243,10 @@ size_t ltt_write_event_header_slow(struct ust_channel *channel, case LTT_RFLAG_ID: header.id_time = 31 << LTT_TSC_BITS; break; + default: + WARN_ON_ONCE(1); + header.id_time = 0; + break; } header.id_time |= (u32)tsc & LTT_TSC_MASK; diff --git a/libust/trace_event.c b/libust/trace_event.c index 76628c5..b54d361 100644 --- a/libust/trace_event.c +++ b/libust/trace_event.c @@ -89,7 +89,7 @@ static void trace_event_get_iter(struct trace_event_iter *iter) int found = 0; found = lib_get_iter_trace_events(iter); -end: + if (!found) trace_event_iter_reset(iter); } diff --git a/libust/tracectl.c b/libust/tracectl.c index 25fa4d5..25f84cc 100644 --- a/libust/tracectl.c +++ b/libust/tracectl.c @@ -828,7 +828,7 @@ static void process_marker_cmd(int sock, int command, { struct ustcomm_header _reply_header; struct ustcomm_header *reply_header = &_reply_header; - int result; + int result = 0; memset(reply_header, 0, sizeof(*reply_header)); diff --git a/libustconsumer/libustconsumer.c b/libustconsumer/libustconsumer.c index 739a222..25c84ce 100644 --- a/libustconsumer/libustconsumer.c +++ b/libustconsumer/libustconsumer.c @@ -445,7 +445,8 @@ static void destroy_buffer(struct ustconsumer_callbacks *callbacks, int consumer_loop(struct ustconsumer_instance *instance, struct buffer_info *buf) { - int result, read_result; + int result = 0; + int read_result; char read_buf; pthread_cleanup_push(decrement_active_buffers, instance); diff --git a/snprintf/vfprintf.c b/snprintf/vfprintf.c index d4953be..1b8fba6 100644 --- a/snprintf/vfprintf.c +++ b/snprintf/vfprintf.c @@ -239,7 +239,7 @@ int ust_safe_vfprintf(LFILE *fp, const char *fmt0, va_list ap) int dprec; /* a copy of prec if %[diouxX], 0 otherwise */ int realsz; /* field size expanded by dprec */ int size; /* size of converted field or string */ - const char *xdigs; /* digits for %[xX] conversion */ + const char *xdigs = NULL; /* digits for %[xX] conversion */ #define NIOV 8 struct __suio uio; /* output information: summary */ struct __siov iov[NIOV];/* ... and individual io vectors */ diff --git a/tests/register_test/register_test.c b/tests/register_test/register_test.c index b593185..d5cd352 100644 --- a/tests/register_test/register_test.c +++ b/tests/register_test/register_test.c @@ -55,7 +55,7 @@ void tptest_probe(void *data, int anint) static void * register_thread_main(void *data) { - int ret, i, j = 0; + int i, j = 0; struct hello_trace_struct hello[HELLO_LENGTH]; diff --git a/tests/tap.c b/tests/tap.c index bd7f81c..a54fd17 100644 --- a/tests/tap.c +++ b/tests/tap.c @@ -37,7 +37,7 @@ static void *_tap_comment_stdout(void *_unused) if (strncmp(line, "_TAP", 4)) { fprintf(normal_stdout, "# %s", line); } else { - fprintf(normal_stdout, &line[4]); + fprintf(normal_stdout, "# %s", &line[4]); } } pthread_exit(0); -- 2.34.1