2020-04-17 07:17:10

by Jason Yan

[permalink] [raw]
Subject: [PATCH] samples/trace_printk: make some symbols static

Fix the following sparse warning:

samples/trace_printk/trace-printk.c:7:6: warning: symbol
'trace_printk_test_global_str' was not declared. Should it be static?
samples/trace_printk/trace-printk.c:10:6: warning: symbol
'trace_printk_test_global_str_irq' was not declared. Should it be
static?
samples/trace_printk/trace-printk.c:13:6: warning: symbol
'trace_printk_test_global_str_fmt' was not declared. Should it be
static?

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Jason Yan <[email protected]>
---
samples/trace_printk/trace-printk.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/samples/trace_printk/trace-printk.c b/samples/trace_printk/trace-printk.c
index cfc159580263..e9bae541905e 100644
--- a/samples/trace_printk/trace-printk.c
+++ b/samples/trace_printk/trace-printk.c
@@ -4,13 +4,13 @@
#include <linux/irq_work.h>

/* Must not be static to force gcc to consider these non constant */
-char *trace_printk_test_global_str =
+static char *trace_printk_test_global_str =
"This is a dynamic string that will use trace_puts\n";

-char *trace_printk_test_global_str_irq =
+static char *trace_printk_test_global_str_irq =
"(irq) This is a dynamic string that will use trace_puts\n";

-char *trace_printk_test_global_str_fmt =
+static char *trace_printk_test_global_str_fmt =
"%sThis is a %s that will use trace_printk\n";

static struct irq_work irqwork;
--
2.21.1