sysctl: quiet unused variable warning in fs/proc/proc_sysctl.c:init_header()
Subsystems (3)
PATCH 1/1 sysctl: quiet unused variable warning in fs/proc/proc_sysctl.c:init_header()
The init_header() function uses list_for_each_table_entry() without using the entry argument. This causes a warning when building with W=1. Since the code is correct, mark the associated variable as __maybe_unused.
--- fs/proc/proc_sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/proc_sysctl.c +1 -1
@@ -206,7 +206,7 @@ static void init_header(struct ctl_table_header *head, head->node = node;INIT_HLIST_HEAD (&head->inodes);if (node) { -const struct ctl_table *entry; +const struct ctl_table *entry__maybe_unused ;list_for_each_table_entry (entry, head) { node->header = head;
Signature · 1 line
2.43.0
Joel Granados
maintainerQuoted 4 lines · Ethan Nelson-Moore
The
init_header()function useslist_for_each_table_entry()without using the entry argument. This causes a warning when building with W=1. Since the code is correct, mark the associated variable as__maybe_unused.
I'm probably compiling in a different way but I don't see that warning. Can you please tell me how you compile, what are you are in. What version of compiler are you running?
Thx
Quoted 22 lines
Signed-off-by Ethan Nelson-Moore <[email protected]>--- fs/proc/proc_sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/proc/proc_sysctl.c +1
-1@@ -206,7 +206,7 @@ static void init_header(struct ctl_table_header *head, head->node = node;INIT_HLIST_HEAD (&head->inodes);if (node) { -const struct ctl_table *entry; +const struct ctl_table *entry__maybe_unused ;list_for_each_table_entry (entry, head) { node->header = head;Signature · 1 line
2.43.0
Hi, Joel,
Quoted 3 lines · Joel Granados
I'm probably compiling in a different way but I don't see that warning. Can you please tell me how you compile, what are you are in. What version of compiler are you running?
I'm using GCC 16.2, which probably explains it, since newer GCC versions have gotten more clever at detecting unused variables.
Ethan
Joel Granados
maintainerQuoted 9 lines · Ethan Nelson-Moore
Hi, Joel,
Quoted 3 lines · Joel Granados
I'm probably compiling in a different way but I don't see that warning. Can you please tell me how you compile, what are you are in. What version of compiler are you running?
I'm using GCC 16.2, which probably explains it, since newer GCC versions have gotten more clever at detecting unused variables.
I'll add it to sysctl-next
best