trace: fix sparse warnings
Subsystems (3)
cover trace: fix sparse warnings
The following series fixes some sparse warnings in kernel/trace.
---
Hannes Eder (3):
trace: fix sparce warning: attribute function with __acquires/__releases
trace: fix sparse warnings: fix (un-)signedness
trace: fix sparse warnings: make symbols static
kernel/trace/ring_buffer.c | 8 ++++---- kernel/trace/trace.c | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-)
PATCH 1/3 trace: fix sparse warnings: make symbols static
Impact: make global variables and a global function static
The function '__trace_userstack' does not seem to have a caller, so it is commented out.
Fix this sparse warnings:
kernel/trace/trace.c:82:5: warning: symbol 'tracing_disabled' was not declared. Should it be static? kernel/trace/trace.c:600:10: warning: symbol 'trace_record_cmdline_disabled' was not declared. Should it be static? kernel/trace/trace.c:957:6: warning: symbol '__trace_userstack' was not declared. Should it be static? kernel/trace/trace.c:1694:5: warning: symbol 'tracing_release' was not declared. Should it be static?
--- kernel/trace/trace.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
kernel/trace/trace.c +6 -4
@@ -79,7 +79,7 @@ static int dummy_set_flag(u32 old_flags, u32 bit, int set)* of the tracer is successful. But that is the only place that sets * this back to zero. */ -int tracing_disabled =1 ; +static int tracing_disabled =1 ; static DEFINE_PER_CPU(local_t, ftrace_cpu_disabled);
@@ -597,7 +597,7 @@ static int cmdline_idx;static DEFINE_SPINLOCK (trace_cmdline_lock);/* temporary disable recording */ -atomic_t trace_record_cmdline_disabled__read_mostly ; +static atomic_t trace_record_cmdline_disabled__read_mostly ;static void trace_init_cmdlines (void ) {
@@ -954,10 +954,12 @@ static void ftrace_trace_userstack(struct trace_array *tr,#endif } -void __trace_userstack (struct trace_array *tr,unsigned long flags) +#ifdef UNUSED +static void __trace_userstack (struct trace_array *tr,unsigned long flags) {ftrace_trace_userstack (tr, flags,preempt_count ()); } +#endif /* UNUSED */ static void ftrace_trace_special(void *__tr,
@@ -1691,7 +1693,7 @@ int tracing_open_generic(struct inode *inode, struct file *filp)return 0 ; } -int tracing_release (struct inode *inode,struct file *file) +static int tracing_release (struct inode *inode,struct file *file) {struct seq_file *m = (struct seq_file *)file->private_data;struct trace_iterator *iter = m->private;
Re: [PATCH 1/3] trace: fix sparse warnings: make symbols static
Quoted 4 lines · Hannes Eder
Impact: make global variables and a global function static
The function '
__trace_userstack' does not seem to have a caller, so it is commented out.
I guess it can even be dropped :-)
Quoted 61 lines
Fix this sparse warnings:
kernel/trace/trace.c:82:5: warning: symbol 'tracing_disabled' was not declared. Should it be static?kernel/trace/trace.c:600:10: warning: symbol 'trace_record_cmdline_disabled' was not declared. Should it be static?kernel/trace/trace.c:957:6: warning: symbol '__trace_userstack' was not declared. Should it be static?kernel/trace/trace.c:1694:5: warning: symbol 'tracing_release' was not declared. Should it be static?Signed-off-by Hannes Eder <[email protected]>--- kernel/trace/trace.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)kernel/trace/trace.c +6
-5@@ -79,7 +79,7 @@ static int dummy_set_flag(u32 old_flags, u32 bit, int set)* of the tracer is successful. But that is the only place that sets * this back to zero. */ -int tracing_disabled =1 ; +static int tracing_disabled =1 ; static DEFINE_PER_CPU(local_t, ftrace_cpu_disabled);@@ -597,7 +597,7 @@ static int cmdline_idx;static DEFINE_SPINLOCK (trace_cmdline_lock);/* temporary disable recording */ -atomic_t trace_record_cmdline_disabled__read_mostly ; +static atomic_t trace_record_cmdline_disabled__read_mostly ;static void trace_init_cmdlines (void ) {@@ -954,10 +954,12 @@ static void ftrace_trace_userstack(struct trace_array *tr,#endif } -void __trace_userstack (struct trace_array *tr,unsigned long flags) +#ifdef UNUSED +static void __trace_userstack (struct trace_array *tr,unsigned long flags) {ftrace_trace_userstack (tr, flags,preempt_count ()); } +#endif /* UNUSED */ static void ftrace_trace_special(void *__tr,@@ -1691,7 +1693,7 @@ int tracing_open_generic(struct inode *inode, struct file *filp)return 0 ; } -int tracing_release (struct inode *inode,struct file *file) +static int tracing_release (struct inode *inode,struct file *file) {struct seq_file *m = (struct seq_file *)file->private_data;struct trace_iterator *iter = m->private; --To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/3 trace: fix sparse warnings: fix (un-)signedness
In reply to Hannes EderFix this sparse warnings:
kernel/trace/ring_buffer.c:70:37: warning: incorrect type in argument 2 (different signedness) kernel/trace/ring_buffer.c:84:39: warning: incorrect type in argument 2 (different signedness) kernel/trace/ring_buffer.c:96:43: warning: incorrect type in argument 2 (different signedness) kernel/trace/ring_buffer.c:2475:13: warning: incorrect type in argument 2 (different signedness) kernel/trace/ring_buffer.c:2475:13: warning: incorrect type in argument 2 (different signedness) kernel/trace/ring_buffer.c:2478:42: warning: incorrect type in argument 2 (different signedness) kernel/trace/ring_buffer.c:2478:42: warning: incorrect type in argument 2 (different signedness) kernel/trace/ring_buffer.c:2500:40: warning: incorrect type in argument 3 (different signedness) kernel/trace/ring_buffer.c:2505:44: warning: incorrect type in argument 2 (different signedness) kernel/trace/ring_buffer.c:2507:46: warning: incorrect type in argument 2 (different signedness) kernel/trace/trace.c:2130:40: warning: incorrect type in argument 3 (different signedness) kernel/trace/trace.c:2280:40: warning: incorrect type in argument 3 (different signedness)
--- kernel/trace/ring_buffer.c | 8 ++++---- kernel/trace/trace.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-)
kernel/trace/ring_buffer.c +4 -4
@@ -57,7 +57,7 @@ enum { RB_BUFFERS_DISABLED = 1 << RB_BUFFERS_DISABLED_BIT, }; -static long ring_buffer_flags__read_mostly =RB_BUFFERS_ON ; +static unsigned long ring_buffer_flags__read_mostly =RB_BUFFERS_ON ;/** * tracing_on - enable all tracing buffers
@@ -2468,7 +2468,7 @@ static ssize_t rb_simple_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { - long *p = filp->private_data; + unsigned long *p = filp->private_data;char buf[64 ];int r;
@@ -2484,9 +2484,9 @@ static ssize_t rb_simple_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { - long *p = filp->private_data; + unsigned long *p = filp->private_data;char buf[64 ]; -long val; +unsigned long val;int ret;if (cnt >=sizeof (buf))
kernel/trace/trace.c +3 -3
@@ -2118,7 +2118,7 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf, {struct trace_array *tr = filp->private_data;char buf[64 ]; -long val; +unsigned long val;int ret;if (cnt >=sizeof (buf))
@@ -2266,9 +2266,9 @@ static ssize_t tracing_max_lat_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { - long *ptr = filp->private_data; + unsigned long *ptr = filp->private_data;char buf[64 ]; -long val; +unsigned long val;int ret;if (cnt >=sizeof (buf))
PATCH 3/3 trace: fix sparce warning: attribute function with __acquires/__releases
In reply to Hannes EderFix this sparse warning:
kernel/trace/trace.c:458:9: warning: context imbalance in 'register_tracer' - unexpected unlock
--- kernel/trace/trace.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/trace/trace.c +2 -0
@@ -439,6 +439,8 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)* Register a new plugin tracer. */ int register_tracer (struct tracer *type) +__releases (kernel_lock) +__acquires (kernel_lock) {struct tracer *t;int len;
Ingo Molnar
AppliedQuoted 10 lines · Hannes Eder
The following series fixes some sparse warnings in kernel/trace.
---
Hannes Eder (3):
trace: fix sparce warning: attribute function with __acquires/__releases
trace: fix sparse warnings: fix (un-)signedness
trace: fix sparse warnings: make symbols static
Quoted 3 lines
kernel/trace/ring_buffer.c | 8 ++++---- kernel/trace/trace.c | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-)
Applied to tip:tracing/ftrace (with minor edits), thanks Hannes!
Ingo