diff mbox

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

Message ID 20081222191517.11807.20718.stgit@vmbox.hanneseder.net
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Hannes Eder Dec. 22, 2008, 7:15 p.m. UTC
Fix this sparse warning:

  drivers/net/niu.c:8850:2: warning: returning void-valued expression

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
 drivers/net/niu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


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

David Miller Dec. 26, 2008, 12:17 a.m. UTC | #1
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.

The types match, the function returns void and it is returning a void,
what is the problem?
--
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
David Miller Dec. 26, 2008, 7:56 a.m. UTC | #2
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>

Whilst, as stated, I disagree with this warning, I've
applied your patch.

Thanks.
--
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 Eder Dec. 26, 2008, 2:39 p.m. UTC | #3
On Fri, Dec 26, 2008 at 1:17 AM, 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.
>
> The types match, the function returns void and it is returning a void,
> what is the problem?

after reading the following thread I decided to submit such type of patches:

On Thu, 1 May 2008 at 13:53:39 +0100, Al Viro wrote:
> On Thu, May 01, 2008 at 03:42:14PM +0300, Boaz Harrosh wrote:
> > > 3.  6.8.6.4(1): A return statement with an expression shall not appear in
> > > a function whose return type is void.
> > >
> >
> > Please forgive my ignorance, where is this quote from?
>
> C99.  I don't have C90 in front of me, so I can't give you exact quote from
> there, but it's been explicitly banned in C90 as well.

see http://lkml.org/lkml/2008/5/1/112
--
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
Randy.Dunlap Dec. 26, 2008, 7:59 p.m. UTC | #4
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?
diff mbox

Patch

diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 022866d..a4b6913 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -8847,7 +8847,7 @@  static u64 niu_pci_map_page(struct device *dev, struct page *page,
 static void niu_pci_unmap_page(struct device *dev, u64 dma_address,
 			       size_t size, enum dma_data_direction direction)
 {
-	return dma_unmap_page(dev, dma_address, size, direction);
+	dma_unmap_page(dev, dma_address, size, direction);
 }
 
 static u64 niu_pci_map_single(struct device *dev, void *cpu_addr,