Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Justin Iurman <justin.iurman@uliege.be>
To: Matthieu Baerts <matthieu.baerts@tessares.net>
Cc: "David S. Miller" <davem@davemloft.net>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	David Ahern <dsahern@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] ipv6: fix "'ioam6_if_id_max' defined but not used" warn
Date: Thu, 22 Jul 2021 20:07:28 +0200 (CEST)	[thread overview]
Message-ID: <651934762.25015210.1626977248685.JavaMail.zimbra@uliege.be> (raw)
In-Reply-To: <20210722075504.1793321-1-matthieu.baerts@tessares.net>

> When compiling without CONFIG_SYSCTL, this warning appears:
> 
>  net/ipv6/addrconf.c:99:12: error: 'ioam6_if_id_max' defined but not used
>  [-Werror=unused-variable]
>     99 | static u32 ioam6_if_id_max = U16_MAX;
>        |            ^~~~~~~~~~~~~~~
>  cc1: all warnings being treated as errors
> 
> Simply moving the declaration of this variable under ...
> 
>  #ifdef CONFIG_SYSCTL
> 
> ... with other similar variables fixes the issue.
> 
> Fixes: 9ee11f0fff20 ("ipv6: ioam: Data plane support for Pre-allocated Trace")
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> ---
> 
> Notes:
>    Please note that this 'ioam6_if_id_max' variable could certainly be
>    declared as 'const' like some others used as limits for sysctl knobs.
>    But here, this patch focuses on fixing the warning reported by GCC.
> 
> net/ipv6/addrconf.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 1802287977f1..db0a89810f28 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -96,8 +96,6 @@
> #define IPV6_MAX_STRLEN \
> 	sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")
> 
> -static u32 ioam6_if_id_max = U16_MAX;
> -
> static inline u32 cstamp_delta(unsigned long cstamp)
> {
> 	return (cstamp - INITIAL_JIFFIES) * 100UL / HZ;
> @@ -6550,6 +6548,7 @@ static int addrconf_sysctl_disable_policy(struct ctl_table
> *ctl, int write,
> 
> static int minus_one = -1;
> static const int two_five_five = 255;
> +static u32 ioam6_if_id_max = U16_MAX;
> 
> static const struct ctl_table addrconf_sysctl[] = {
> 	{
> --
> 2.31.1

Good catch, thanks for the patch.

      parent reply	other threads:[~2021-07-22 18:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  7:55 Matthieu Baerts
2021-07-22  9:30 ` patchwork-bot+netdevbpf
2021-07-22 18:07 ` Justin Iurman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=651934762.25015210.1626977248685.JavaMail.zimbra@uliege.be \
    --to=justin.iurman@uliege.be \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthieu.baerts@tessares.net \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    --subject='Re: [PATCH net-next] ipv6: fix "'\''ioam6_if_id_max'\'' defined but not used" warn' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).