Re: [PATCH] sysctl: quiet unused variable warning in fs/proc/proc_sysctl.c:init_header()

Joel Granados <[email protected]>
Newsgroups org.kernel.vger.linux-fsdevel
Message-ID <iguoigeao5itgylh6kmzwiiuwk4pqra32vpqvyv2ingitchs4w@pctwdteu52mh>
On Thu, Sep 17, 2026 at 11:23:38PM -0700, Ethan Nelson-Moore wrote:
> 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.

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
> 
> Signed-off-by: Ethan Nelson-Moore <[email protected]>
> ---
>  fs/proc/proc_sysctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> index 04a382178c65..d0d76c31d330 100644
> --- a/fs/proc/proc_sysctl.c
> +++ b/fs/proc/proc_sysctl.c
> @@ -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;
> -- 
> 2.43.0
>
signature.asc (application/pgp-signature, 659 B)
-----BEGIN PGP SIGNATURE-----

iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmqtGtUACgkQupfNUreW
QU8aPAv/STzTb7hj2WgkJ9nQBUBhNvCgYH9IEp7vw/7is/UOpf/Cr8zPJ3sU1DnM
UovVLAAYMhZ0MVwVqONB4v9lGdigGumKSKUI/9irXEkUuYmB1BEvnZW670CBWjld
/1iRqiYiZry0r6mT5+2GiNGjDaopF45qH1wHOV+qDHdCNT7/IT+RYyrN8FZ2wHb+
BrT1fQm0Vo0b5H84uFpx538LHEMVx+r7Cj7RkhvkYXViUYymNGgeAUYqgTkeuuGo
5WBXFqXRtvoL9ULdq8gXGkAQ4E8Cm/bqw8hZHpDnwKRhqFUuW1NTNFX03CGAhrRR
8ETG5nhsD7/9PoXo5PVlPyz03YyHHasPiTR8YxeKSY8V3mYWfvTtLLdx9aXc5Paz
TJXttvaR5TyXD5qba5zGAzh70Z+Wlt8iNWyxCsMgreAW/aBzVo1J9PlMgekQX5gk
+5VL03w2zVn66ZIFqRwibYweQsaTkuv+cC5c60LQcBOYn2Yv12/vJJfnDw808JhN
tjmePb8h
=dlh9
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.