The err_text array contains string literals that are never modified.
Previously it was declared as:

    static const char *err_text[]

which makes the strings themselves const but allows the pointers
in the array to be changed.

Change it to:

    static const char * const err_text[]

This prevents accidental modification of the array pointers,
fixes checkpatch warnings, and allows the compiler to place the
entire array in the read-only data section (.rodata).

Signed-off-by: Huiwen He <[email protected]>
---
 kernel/trace/trace_events_hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 1d536219b624..3be35ebdaa62 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -80,7 +80,7 @@ enum { ERRORS };
 #undef C
 #define C(a, b)                b
 
-static const char *err_text[] = { ERRORS };
+static const char * const err_text[] = { ERRORS };
 
 struct hist_field;
 
-- 
2.25.1


Reply via email to