diff mbox

mISDN: Ignore return value of driver_for_each_device in function hfcpci_softirq.

Message ID 1335309230-23428-1-git-send-email-krzysztof.wilczynski@linux.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Krzysztof Wilczynski April 24, 2012, 11:13 p.m. UTC
Function hfcpci_softirq uses driver_for_each_device to call _hfcpci_softirq for
each device. Given that _hfcpci_softirq always returns 0, we collect this return
value and simply do nothing with it.  This is purely to address the following
warning during compilation time:

  drivers/isdn/hardware/mISDN/hfcpci.c: In function ‘hfcpci_softirq’:
  drivers/isdn/hardware/mISDN/hfcpci.c:2319: warning: ignoring return value of
    ‘driver_for_each_device’, declared with attribute warn_unused_result

Similar approach was used in function cx18_alsa_exit from "cx18-alsa-main.c".

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
---
 drivers/isdn/hardware/mISDN/hfcpci.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Comments

David Miller April 26, 2012, 12:42 a.m. UTC | #1
From: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>

Date: Wed, 25 Apr 2012 00:13:50 +0100

> Function hfcpci_softirq uses driver_for_each_device to call _hfcpci_softirq for

> each device. Given that _hfcpci_softirq always returns 0, we collect this return

> value and simply do nothing with it.  This is purely to address the following

> warning during compilation time:

> 

>   drivers/isdn/hardware/mISDN/hfcpci.c: In function ‘hfcpci_softirq’:

>   drivers/isdn/hardware/mISDN/hfcpci.c:2319: warning: ignoring return value of

>     ‘driver_for_each_device’, declared with attribute warn_unused_result

> 

> Similar approach was used in function cx18_alsa_exit from "cx18-alsa-main.c".

> 

> Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>


There is no value in the warning if we simply convert each such case
to ignore the return value.

I'm not applying this, at least not with a more intelligent analysis
of why any error or other non-zero value signalled by
driver_for_each_device should be completely ignored, and no error
handling should be performed.
Krzysztof Wilczynski April 26, 2012, 3:08 p.m. UTC | #2
Hi,

[...]
> I'm not applying this, at least not with a more intelligent analysis
> of why any error or other non-zero value signalled by
> driver_for_each_device should be completely ignored, and no error
> handling should be performed.

This is a fair point.  It should not be ignored.  I was looking through
the code and found few cases where the return value was not checked
for potential errors (I assume that it was collected to avoid warning being
produced, but that was about it) without printing an error message.

The following could most certainly use better error reporting concerning
use of driver_for_each_device:

drivers/isdn/hardware/mISDN/hfcpci.c
drivers/media/video/cx18/cx18-alsa-main.c
drivers/media/video/ivtv/ivtvfb.c

I will look into it making suitable changes.  Thanks for pointing it
out to me! :)

KW
--
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/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index e2c83a2..f0d0180 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -2316,8 +2316,11 @@  _hfcpci_softirq(struct device *dev, void *arg)
 static void
 hfcpci_softirq(void *arg)
 {
-	(void) driver_for_each_device(&hfc_driver.driver, NULL, arg,
-				      _hfcpci_softirq);
+	int ret;
+
+	/* Collect return value, but do not use it; suppress GCC warning ... */
+	ret = driver_for_each_device(&hfc_driver.driver, NULL, arg,
+				     _hfcpci_softirq);
 
 	/* if next event would be in the past ... */
 	if ((s32)(hfc_jiffies + tics - jiffies) <= 0)