diff mbox

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

Message ID 1384570328-21666-1-git-send-email-festevam@gmail.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Fabio Estevam Nov. 16, 2013, 2:52 a.m. UTC
From: Fabio Estevam <fabio.estevam@freescale.com>

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'.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 net/ipv6/af_inet6.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Vladislav Yasevich Nov. 16, 2013, 6:05 p.m. UTC | #1
On 11/15/2013 09:52 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> 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'.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  net/ipv6/af_inet6.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
> index ff75313..e4ad65c 100644
> --- a/net/ipv6/af_inet6.c
> +++ b/net/ipv6/af_inet6.c
> @@ -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)
>  {
> 

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

-vlad
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vladislav Yasevich Nov. 16, 2013, 6:22 p.m. UTC | #2
On 11/16/2013 01:05 PM, Vlad Yasevich wrote:
> On 11/15/2013 09:52 PM, Fabio Estevam wrote:
>> From: Fabio Estevam <fabio.estevam@freescale.com>
>>
>> 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'.
>>
>> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
>> ---
>>  net/ipv6/af_inet6.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
>> index ff75313..e4ad65c 100644
>> --- a/net/ipv6/af_inet6.c
>> +++ b/net/ipv6/af_inet6.c
>> @@ -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)
>>  {
>>
> 
> 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


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hannes Frederic Sowa Nov. 16, 2013, 6:26 p.m. UTC | #3
On Sat, Nov 16, 2013 at 01:05:22PM -0500, Vlad Yasevich wrote:
> On 11/15/2013 09:52 PM, Fabio Estevam wrote:
> > From: Fabio Estevam <fabio.estevam@freescale.com>
> > 
> > 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'.
> > 
> > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> > ---
> >  net/ipv6/af_inet6.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
> > index ff75313..e4ad65c 100644
> > --- a/net/ipv6/af_inet6.c
> > +++ b/net/ipv6/af_inet6.c
> > @@ -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)
> >  {
> > 
> 
> 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?

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index ff75313..e4ad65c 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -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)
 {