panic: sys_info: rewrite a fix for a compilation error (`make W=1`)
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 30 Oct 2025 11:44:20 +0000 (12:44 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 20 Nov 2025 22:03:40 +0000 (14:03 -0800)
commiteb72c4667f4567a7363f6e00d082d2ab32b6a03a
tree858f566bb99d3780435fa7e2fef7162bb5b90229
parentd13adc6147f5848d6ad9900fdb1dbf9a280a2f64
panic: sys_info: rewrite a fix for a compilation error (`make W=1`)

Compiler was not happy about dead variable in use:

lib/sys_info.c:52:19: error: variable 'sys_info_avail' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
   52 | static const char sys_info_avail[] = "tasks,mem,timers,locks,ftrace,all_bt,blocked_tasks";
      |                   ^~~~~~~~~~~~~~

This was fixed by adding __maybe_unused attribute that just hides the
issue and didn't actually fix the root cause.  Rewrite the fix by moving
the local variable from stack to a heap.

As a side effect this drops unneeded "synchronisation" of duplicative info
and also makes code ready for the further refactoring.

Link: https://lkml.kernel.org/r/20251030132007.3742368-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: Feng Tang <feng.tang@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/sys_info.c