Skip to contentSkip to conversation

net: ipv6: af_inet6: Fix warning when CONFIG_SYSCTL=n

PATCH Applied Fabio Estevam 4 participants 6 messages Nov 16, 2013 – Nov 18, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: ipv6: af_inet6: Fix warning when CONFIG_SYSCTL=n

From: Fabio Estevam <[email protected]>

When CONFIG_SYSCTL=n the following build warning happens:

net/ipv6/af_inet6.c:710:13: warning: 'ipv6_packet_cleanup' defined but not used [-Wunused-function]

ipv6_packet_cleanup() is only used when CONFIG_SYSCTL=y, so protect its definition with an'ifdef CONFIG_SYSCTL'.

---
 net/ipv6/af_inet6.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv6/af_inet6.c +2 -0
index ff75313..e4ad65c 100644
@@ -707,10 +707,12 @@ static int __init ipv6_packet_init(void)
 	return 0;
 }
 
+#ifdef CONFIG_SYSCTL
 static void ipv6_packet_cleanup(void)
 {
 	dev_remove_pack(&ipv6_packet_type);
 }
+#endif
 
 static int __net_init ipv6_init_mibs(struct net *net)
 {
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 2/2 net: ipv6: ndisc: Fix warning when CONFIG_SYSCTL=n

From: Fabio Estevam <[email protected]>

When CONFIG_SYSCTL=n the following build warning happens:

net/ipv6/ndisc.c:1730:1: warning: label 'out' defined but not used [-Wunused-label]

The 'out' label is only used when CONFIG_SYSCTL=y, so move it inside the 'ifdef CONFIG_SYSCTL' block.

---
 net/ipv6/ndisc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ndisc.c +1 -1
index f8a55ff..3512177 100644
@@ -1726,8 +1726,8 @@ int __init ndisc_init(void)
 				    &ndisc_ifinfo_sysctl_change);
 	if (err)
 		goto out_unregister_pernet;
-#endif
 out:
+#endif
 	return err;
 
 #ifdef CONFIG_SYSCTL
Signature · 1 line
1.8.1.2
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] net: ipv6: ndisc: Fix warning when CONFIG_SYSCTL=n

From: Fabio Estevam <[email protected]>
Date: Sat, 16 Nov 2013 00:52:08 -0200

Quoted 10 lines

From: Fabio Estevam <[email protected]>

When CONFIG_SYSCTL=n the following build warning happens:

net/ipv6/ndisc.c:1730:1: warning: label 'out' defined but not used [-Wunused-label]

The 'out' label is only used when CONFIG_SYSCTL=y, so move it inside the 'ifdef CONFIG_SYSCTL' block.

Applied.

#3 lore raw
In reply to Fabio Estevam
Quoted 22 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

When CONFIG_SYSCTL=n the following build warning happens:

net/ipv6/af_inet6.c:710:13: warning: 'ipv6_packet_cleanup' defined but not used [-Wunused-function]

ipv6_packet_cleanup() is only used when CONFIG_SYSCTL=y, so protect its definition with an'ifdef CONFIG_SYSCTL'.

---
 net/ipv6/af_inet6.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv6/af_inet6.c +0 -0
index ff75313..e4ad65c 100644
@@ -707,10 +707,12 @@ static int __init ipv6_packet_init(void)
 	return 0;
 }

net/ipv6/af_inet6.c static int __init ipv6_packet_init(void) · line 718

Quoted 10 lines
net/ipv6/af_inet6.c +2 -0
 
+#ifdef CONFIG_SYSCTL
 static void ipv6_packet_cleanup(void)
 {
 	dev_remove_pack(&ipv6_packet_type);
 }
+#endif
 
 static int __net_init ipv6_init_mibs(struct net *net)
 {

NACK. ipv6_packet_init and ipv6_packet_cleanup should in no way depend on sysctl.

-vlad

#4 lore raw
Quoted 30 lines · Vlad Yasevich
Quoted 29 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

When CONFIG_SYSCTL=n the following build warning happens:

net/ipv6/af_inet6.c:710:13: warning: 'ipv6_packet_cleanup' defined but not used [-Wunused-function]

ipv6_packet_cleanup() is only used when CONFIG_SYSCTL=y, so protect its definition with an'ifdef CONFIG_SYSCTL'.

---
 net/ipv6/af_inet6.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv6/af_inet6.c +2 -0
index ff75313..e4ad65c 100644
@@ -707,10 +707,12 @@ static int __init ipv6_packet_init(void)
 	return 0;
 }
 
+#ifdef CONFIG_SYSCTL
 static void ipv6_packet_cleanup(void)
 {
 	dev_remove_pack(&ipv6_packet_type);
 }
+#endif
 
Quoted 9 lines

net/ipv6/af_inet6.c static int __init ipv6_packet_init(void) · line 718

Quoted 3 lines
net/ipv6/af_inet6.c +0 -0
 static int __net_init ipv6_init_mibs(struct net *net)
 {

NACK. ipv6_packet_init and ipv6_packet_cleanup should in no way depend on sysctl.

-vlad

It actually appears a bit worse then that. Looks like the inet6_init() error were a bit messed up after the introduction of ping socket support.

-vlad

#5 lore raw
In reply to Vlad Yasevich
Quoted 30 lines · Vlad Yasevich
Quoted 29 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

When CONFIG_SYSCTL=n the following build warning happens:

net/ipv6/af_inet6.c:710:13: warning: 'ipv6_packet_cleanup' defined but not used [-Wunused-function]

ipv6_packet_cleanup() is only used when CONFIG_SYSCTL=y, so protect its definition with an'ifdef CONFIG_SYSCTL'.

---
 net/ipv6/af_inet6.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv6/af_inet6.c +2 -0
index ff75313..e4ad65c 100644
@@ -707,10 +707,12 @@ static int __init ipv6_packet_init(void)
 	return 0;
 }
 
+#ifdef CONFIG_SYSCTL
 static void ipv6_packet_cleanup(void)
 {
 	dev_remove_pack(&ipv6_packet_type);
 }
+#endif
 
Quoted 6 lines

net/ipv6/af_inet6.c static int __init ipv6_packet_init(void) · line 718

Quoted 3 lines
net/ipv6/af_inet6.c +0 -0
 static int __net_init ipv6_init_mibs(struct net *net)
 {

NACK. ipv6_packet_init and ipv6_packet_cleanup should in no way depend on sysctl.

It is only used in an error path if CONFIG_SYSCTL=y. I agree it does look a bit odd.

Maybe just add __maybe_unused to ipv6_packet_cleanup?