diff mbox series

[net-next] ipv6: fix "'ioam6_if_id_max' defined but not used" warn

Message ID 20210722075504.1793321-1-matthieu.baerts@tessares.net (mailing list archive)
State Accepted
Commit 176f716cb72fea93d60cb378a3e02d4b630b93c2
Delegated to: Netdev Maintainers
Headers show
Series [net-next] ipv6: fix "'ioam6_if_id_max' defined but not used" warn | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Matthieu Baerts July 22, 2021, 7:55 a.m. UTC
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(-)

Comments

patchwork-bot+netdevbpf@kernel.org July 22, 2021, 9:30 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Thu, 22 Jul 2021 09:55:04 +0200 you wrote:
> 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
> 
> [...]

Here is the summary with links:
  - [net-next] ipv6: fix "'ioam6_if_id_max' defined but not used" warn
    https://git.kernel.org/netdev/net-next/c/176f716cb72f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Justin Iurman July 22, 2021, 6:07 p.m. UTC | #2
> 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.
diff mbox series

Patch

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[] = {
 	{