diff mbox

[03/27] drivers/net: fix sparse warning: returning void-valued expression

Message ID 49567dd3.0b38560a.3c6c.0511@mx.google.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Hannes Eder Dec. 27, 2008, 7:11 p.m. UTC
On 12/26/08, Randy Dunlap <rdunlap@xenotime.net> wrote:
> On Thu, 25 Dec 2008 16:17:40 -0800 (PST)
>  
> David Miller <davem@davemloft.net> wrote:
>  
>  
> > From: Hannes Eder <hannes@hanneseder.net>
>  > Date: Mon, 22 Dec 2008 20:15:17 +0100
>  >
>  > > Fix this sparse warning:
>  > >
>  > >   drivers/net/niu.c:8850:2: warning: returning void-valued expression
>  > >
>  > > Signed-off-by: Hannes Eder <hannes@hanneseder.net>
>  >
>  > Can we just fix sparse not to generate this warning?  It's
>  > marginal, at best.  C++ even explicitly defines this as valid
>  > and last time I brought this up Linus even agreed.
>  
>  
> Ack, I discussed it with him also and he thought that
>  they were just fine as they were...
>  
> 
>  > The types match, the function returns void and it is returning a void,
>  > what is the problem?

In fact there is no need to _fix_ sparse, as there is a command line option
-Wreturn-void / -Wno-return-void, so we could change the Makefile, see diff
below.

---

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

Comments

Sam Ravnborg Dec. 27, 2008, 7:20 p.m. UTC | #1
On Sat, Dec 27, 2008 at 08:11:11PM +0100, Hannes Eder wrote:
> On 12/26/08, Randy Dunlap <rdunlap@xenotime.net> wrote:
> > On Thu, 25 Dec 2008 16:17:40 -0800 (PST)
> >  
> > David Miller <davem@davemloft.net> wrote:
> >  
> >  
> > > From: Hannes Eder <hannes@hanneseder.net>
> >  > Date: Mon, 22 Dec 2008 20:15:17 +0100
> >  >
> >  > > Fix this sparse warning:
> >  > >
> >  > >   drivers/net/niu.c:8850:2: warning: returning void-valued expression
> >  > >
> >  > > Signed-off-by: Hannes Eder <hannes@hanneseder.net>
> >  >
> >  > Can we just fix sparse not to generate this warning?  It's
> >  > marginal, at best.  C++ even explicitly defines this as valid
> >  > and last time I brought this up Linus even agreed.
> >  
> >  
> > Ack, I discussed it with him also and he thought that
> >  they were just fine as they were...
> >  
> > 
> >  > The types match, the function returns void and it is returning a void,
> >  > what is the problem?
> 
> In fact there is no need to _fix_ sparse, as there is a command line option
> -Wreturn-void / -Wno-return-void, so we could change the Makefile, see diff
> below.

It is default off but out use of "-Wall" turn it on.
So your patch is the right approach.

Can you please re-send it with a proper changelog and signed-off.

	Sam
--
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/Makefile b/Makefile
index 64f14aa..cc62984 100644
--- a/Makefile
+++ b/Makefile
@@ -321,7 +321,7 @@  KALLSYMS    = scripts/kallsyms
 PERL           = perl
 CHECK          = sparse
 
-CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF)
+CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise -Wno-return-void $(CF)
 MODFLAGS       = -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)