* [PATCH 1/1] 2.6.24, net/bluetooth/hci_sysfs.c, cleaned code remove compiler warning
@ 2008-01-27 2:53 Michael Kühn
2008-01-27 7:00 ` Linus Torvalds
0 siblings, 1 reply; 2+ messages in thread
From: Michael Kühn @ 2008-01-27 2:53 UTC (permalink / raw)
To: linux-kernel; +Cc: torvalds
Hi,
the attached Patch will remove a compiler warning in
net/bluetooth/hci_sysfs.c:
--- hci_sysfs.c 2008-01-27 03:48:47.000000000 +0100
+++ hci_sysfs.c_new 2008-01-27 03:37:19.000000000 +0100
@@ -332,7 +332,7 @@
struct device *dev;
struct hci_conn *conn = container_of(work, struct hci_conn, work);
- while (dev = device_find_child(&conn->dev, NULL, __match_tty)) {
+ while ((dev = device_find_child(&conn->dev, NULL, __match_tty))) {
device_move(dev, NULL);
put_device(dev);
}
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 1/1] 2.6.24, net/bluetooth/hci_sysfs.c, cleaned code remove compiler warning
2008-01-27 2:53 [PATCH 1/1] 2.6.24, net/bluetooth/hci_sysfs.c, cleaned code remove compiler warning Michael Kühn
@ 2008-01-27 7:00 ` Linus Torvalds
0 siblings, 0 replies; 2+ messages in thread
From: Linus Torvalds @ 2008-01-27 7:00 UTC (permalink / raw)
To: Michael K?hn; +Cc: linux-kernel
On Sun, 27 Jan 2008, Michael K?hn wrote:
>
> the attached Patch will remove a compiler warning in
> net/bluetooth/hci_sysfs.c:
Please don't do this. I realize that gcc suggests just adding parenthesis,
and yes, it makes the warning go away, but it's not sensible from a human
semantic standpoint.
So if the warning bothers you, please change
while (dev = device_find_child(..)) {
into something like
while ((dev = device_find_child(..)) != NULL) {
which also gets rid of the warning, but now does it with something that
makes sense to a human too.
Just arbitrarily adding another set of parentheses never made much sense
to me. It's semantically still the exact same expression, just the fact
that gcc suddenly doesn't warn about the assignment because it's "hidden"
by the extra parenthesis is just odd.
Linus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-27 7:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-27 2:53 [PATCH 1/1] 2.6.24, net/bluetooth/hci_sysfs.c, cleaned code remove compiler warning Michael Kühn
2008-01-27 7:00 ` Linus Torvalds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox