Messages in this thread |  | | | Date | Sat, 16 Feb 2008 01:54:42 -0800 | | From | Andrew Morton <> | | Subject | Re: + bluetooth-fix-warning-in-net-bluetooth-hci_sysfsc.patch added to -mm tree | |
On Sat, 16 Feb 2008 01:27:41 -0800 (PST) David Miller <davem@davemloft.net> wrote:
> From: akpm@linux-foundation.org
> Date: Fri, 15 Feb 2008 20:49:33 -0800
>
> > Subject: bluetooth: fix warning in net/bluetooth/hci_sysfs.c
> > From: Andrew Morton <akpm@linux-foundation.org>
> >
> > net/bluetooth/hci_sysfs.c: In function 'del_conn':
> > net/bluetooth/hci_sysfs.c:339: warning: suggest parentheses around assignment used as truth value
> >
> > Cc: Dave Young <hidave.darkstar@gmail.com>
> > Cc: David S. Miller <davem@davemloft.net>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>
> Linus barfed when this exact patch got posted a few weeks
> ago, he said he considers just adding parenthesis to quiet
> this warning awful and explicit NULL test should be used.
- while (dev = device_find_child(&conn->dev, NULL, __match_tty)) {
+ while ((dev = device_find_child(&conn->dev, NULL, __match_tty))) {
hrm.
box:/usr/src/linux-2.6.25-rc2> grep -r 'while [(][(].*{$' . | wc -l
1240
box:/usr/src/linux-2.6.25-rc2> grep -r 'while [(][(].*{$' . | grep -v NULL | wc -l
867
so two thirds of them presently don't bother testing for NULL. It's a
pretty common idiom.
(adds the != NULL, sees that it reaches column 82, drops patch in disgust)
|  |