Commit 3a301d7c authored by Steven Rostedt's avatar Steven Rostedt Committed by Steven Rostedt

tracing: Clean up tb_fmt to not give faulty compile warning

gcc incorrectly states that the variable "fmt" is uninitialized when
CC_OPITMIZE_FOR_SIZE is set.

Instead of just blindly setting fmt to NULL, the code is cleaned up
a little to be a bit easier for humans to follow, as well as gcc
to know the variables are initialized.
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 322a8b03
...@@ -59,18 +59,19 @@ void hold_module_trace_bprintk_format(const char **start, const char **end) ...@@ -59,18 +59,19 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)
continue; continue;
} }
fmt = NULL;
tb_fmt = kmalloc(sizeof(*tb_fmt), GFP_KERNEL); tb_fmt = kmalloc(sizeof(*tb_fmt), GFP_KERNEL);
if (tb_fmt) if (tb_fmt) {
fmt = kmalloc(strlen(*iter) + 1, GFP_KERNEL); fmt = kmalloc(strlen(*iter) + 1, GFP_KERNEL);
if (tb_fmt && fmt) { if (fmt) {
list_add_tail(&tb_fmt->list, &trace_bprintk_fmt_list); list_add_tail(&tb_fmt->list, &trace_bprintk_fmt_list);
strcpy(fmt, *iter); strcpy(fmt, *iter);
tb_fmt->fmt = fmt; tb_fmt->fmt = fmt;
*iter = tb_fmt->fmt; } else
} else {
kfree(tb_fmt); kfree(tb_fmt);
*iter = NULL;
} }
*iter = fmt;
} }
mutex_unlock(&btrace_mutex); mutex_unlock(&btrace_mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment