* [PATCH] device_for_each_child(): kill pointless warning noise
@ 2006-09-28 1:05 Jeff Garzik
2006-09-28 1:42 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Garzik @ 2006-09-28 1:05 UTC (permalink / raw)
To: LKML, Greg KH, Andrew Morton, Linus Torvalds
As the last patch demonstrated, it is quite valid for a caller to ignore
the return value of device_for_each_child(), given that the return value
is wholly dependent on the actor -- which in practice often has a
hardcoded return value.
Please apply, to reduce a portion of the warning explosion seen in
current linux-2.6.git.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
diff --git a/include/linux/device.h b/include/linux/device.h
index 662e6a1..9d4f6a9 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -393,7 +393,7 @@ extern void device_unregister(struct dev
extern void device_initialize(struct device * dev);
extern int __must_check device_add(struct device * dev);
extern void device_del(struct device * dev);
-extern int __must_check device_for_each_child(struct device *, void *,
+extern int device_for_each_child(struct device *, void *,
int (*fn)(struct device *, void *));
extern int device_rename(struct device *dev, char *new_name);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] device_for_each_child(): kill pointless warning noise
2006-09-28 1:05 [PATCH] device_for_each_child(): kill pointless warning noise Jeff Garzik
@ 2006-09-28 1:42 ` Andrew Morton
2006-09-28 1:50 ` Jeff Garzik
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2006-09-28 1:42 UTC (permalink / raw)
To: Jeff Garzik; +Cc: LKML, Greg KH, Linus Torvalds
On Wed, 27 Sep 2006 21:05:18 -0400
Jeff Garzik <jeff@garzik.org> wrote:
> As the last patch demonstrated, it is quite valid for a caller to ignore
> the return value of device_for_each_child(), given that the return value
> is wholly dependent on the actor -- which in practice often has a
> hardcoded return value.
Yes, but almost all of the instances which you found are flat-out *wrong*.
They're returning 0 or 1 at random places in the callchain because they're
calling intermediate void-returning functions which are themselves dropping
error codes on the floor instead of returning them.
Let no error go unhandled!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] device_for_each_child(): kill pointless warning noise
2006-09-28 1:42 ` Andrew Morton
@ 2006-09-28 1:50 ` Jeff Garzik
2006-09-28 11:30 ` Alan Cox
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Garzik @ 2006-09-28 1:50 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Greg KH, Linus Torvalds
Andrew Morton wrote:
> On Wed, 27 Sep 2006 21:05:18 -0400
> Jeff Garzik <jeff@garzik.org> wrote:
>
>> As the last patch demonstrated, it is quite valid for a caller to ignore
>> the return value of device_for_each_child(), given that the return value
>> is wholly dependent on the actor -- which in practice often has a
>> hardcoded return value.
>
> Yes, but almost all of the instances which you found are flat-out *wrong*.
> They're returning 0 or 1 at random places in the callchain because they're
> calling intermediate void-returning functions which are themselves dropping
> error codes on the floor instead of returning them.
"almost all" Thus it is wrong to _force_ the usage model on the caller.
It should be obvious that a simple search need not _require_ a dummy
return value, that is promptly ignored.
See previous email for examples.
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] device_for_each_child(): kill pointless warning noise
2006-09-28 1:50 ` Jeff Garzik
@ 2006-09-28 11:30 ` Alan Cox
0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2006-09-28 11:30 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Andrew Morton, LKML, Greg KH, Linus Torvalds
Ar Mer, 2006-09-27 am 21:50 -0400, ysgrifennodd Jeff Garzik:
> "almost all" Thus it is wrong to _force_ the usage model on the caller.
>
> It should be obvious that a simple search need not _require_ a dummy
> return value, that is promptly ignored.
How about just adding an explicit device_for_each_child_noret() or
similar function so that the safety check stays as well for the usual
case.
Alan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-09-28 11:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-28 1:05 [PATCH] device_for_each_child(): kill pointless warning noise Jeff Garzik
2006-09-28 1:42 ` Andrew Morton
2006-09-28 1:50 ` Jeff Garzik
2006-09-28 11:30 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox