linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mISDN: Ignore return value of driver_for_each_device in function hfcpci_softirq.
@ 2012-04-24 23:13 Krzysztof Wilczynski
  2012-04-26  0:42 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Wilczynski @ 2012-04-24 23:13 UTC (permalink / raw)
  To: Karsten Keil
  Cc: Greg Kroah-Hartman, Simon Horman, Jiri Kosina, netdev, linux-kernel

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

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mISDN: Ignore return value of driver_for_each_device in function hfcpci_softirq.
  2012-04-24 23:13 [PATCH] mISDN: Ignore return value of driver_for_each_device in function hfcpci_softirq Krzysztof Wilczynski
@ 2012-04-26  0:42 ` David Miller
  2012-04-26 15:08   ` Krzysztof Wilczynski
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2012-04-26  0:42 UTC (permalink / raw)
  To: krzysztof.wilczynski; +Cc: isdn, gregkh, horms, trivial, netdev, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: Text/Plain; charset=iso-8859-7, Size: 1245 bytes --]

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.
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mISDN: Ignore return value of driver_for_each_device in function hfcpci_softirq.
  2012-04-26  0:42 ` David Miller
@ 2012-04-26 15:08   ` Krzysztof Wilczynski
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Wilczynski @ 2012-04-26 15:08 UTC (permalink / raw)
  To: David Miller; +Cc: isdn, gregkh, horms, trivial, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-26 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-24 23:13 [PATCH] mISDN: Ignore return value of driver_for_each_device in function hfcpci_softirq Krzysztof Wilczynski
2012-04-26  0:42 ` David Miller
2012-04-26 15:08   ` Krzysztof Wilczynski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).