2008-02-10 02:59:19

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] Silent compiler warning introduced by acea6852f32b8805e166d885ed7e9f0c7cd10d41 ([BLUETOOTH]: Move children of connection device to NULL before connection down.)

Hi;

Following patch silents

net/bluetooth/hci_sysfs.c: In function `del_conn':
net/bluetooth/hci_sysfs.c:339: warning: suggest parentheses around assignment used as truth value

compiler warning introduced by commit acea6852f32b8805e166d885ed7e9f0c7cd10d41 ([BLUETOOTH]: Move children of connection device to NULL before connection down.)

Signed-off-by: S.Çağlar Onur <[email protected]>

net/bluetooth/hci_sysfs.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index e13cf5e..d2d1e4f 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -336,7 +336,7 @@ static void del_conn(struct work_struct *work)
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)) != NULL) {
device_move(dev, NULL);
put_device(dev);
}

Cheers
--
S.Çağlar Onur <[email protected]>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!


2008-02-10 09:57:20

by Richard Knutsson

[permalink] [raw]
Subject: Re: [PATCH] Silent compiler warning introduced by acea6852f32b8805e166d885ed7e9f0c7cd10d41 ([BLUETOOTH]: Move children of connection device to NULL before connection down.)

S.Çağlar Onur wrote:
> Hi;
>
> Following patch silents
>
> net/bluetooth/hci_sysfs.c: In function `del_conn':
> net/bluetooth/hci_sysfs.c:339: warning: suggest parentheses around assignment used as truth value
>
> compiler warning introduced by commit acea6852f32b8805e166d885ed7e9f0c7cd10d41 ([BLUETOOTH]: Move children of connection device to NULL before connection down.)
>
> Signed-off-by: S.Çağlar Onur <[email protected]>
>
> net/bluetooth/hci_sysfs.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
> index e13cf5e..d2d1e4f 100644
> --- a/net/bluetooth/hci_sysfs.c
> +++ b/net/bluetooth/hci_sysfs.c
> @@ -336,7 +336,7 @@ static void del_conn(struct work_struct *work)
> 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)) != NULL) {
>
Why do you need '!= NULL'?

2008-02-10 14:23:20

by S.Çağlar Onur

[permalink] [raw]
Subject: Re: [PATCH] Silent compiler warning introduced by acea6852f32b8805e166d885ed7e9f0c7cd10d41 ([BLUETOOTH]: Move children of connection device to NULL before connection down.)

Hi;

10 Şub 2008 Paz tarihinde, Richard Knutsson şunları yazmıştı:
> S.Çağlar Onur wrote:
> > Hi;
> >
> > Following patch silents
> >
> > net/bluetooth/hci_sysfs.c: In function `del_conn':
> > net/bluetooth/hci_sysfs.c:339: warning: suggest parentheses around assignment used as truth value
> >
> > compiler warning introduced by commit acea6852f32b8805e166d885ed7e9f0c7cd10d41 ([BLUETOOTH]: Move children of connection device to NULL before connection down.)
> >
> > Signed-off-by: S.Çağlar Onur <[email protected]>
> >
> > net/bluetooth/hci_sysfs.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
> > index e13cf5e..d2d1e4f 100644
> > --- a/net/bluetooth/hci_sysfs.c
> > +++ b/net/bluetooth/hci_sysfs.c
> > @@ -336,7 +336,7 @@ static void del_conn(struct work_struct *work)
> > 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)) != NULL) {
> >
> Why do you need '!= NULL'?

I thought its more readable than

while ((dev = device_find_child(&conn->dev, NULL, __match_tty))) {

Cheers
--
S.Çağlar Onur <[email protected]>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!


Attachments:
(No filename) (1.41 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2008-02-10 18:59:44

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] Silent compiler warning introduced by acea6852f32b8805e166d885ed7e9f0c7cd10d41 ([BLUETOOTH]: Move children of connection device to NULL before connection down.)



On Sun, 10 Feb 2008, S.Çağlar Onur wrote:
> > >
> > > - while (dev = device_find_child(&conn->dev, NULL, __match_tty)) {
> > > + while ((dev = device_find_child(&conn->dev, NULL, __match_tty)) != NULL) {
> > >
> > Why do you need '!= NULL'?
>
> I thought its more readable than
>
> while ((dev = device_find_child(&conn->dev, NULL, __match_tty))) {

Yes indeed. I hate the idiotic "double parenthesis without any meaning".
I'd much rather see "((..) != NULL)" than "((..))", because the latter is
totally meaningless semantically (although gcc gives it semantics).

Linus

2008-02-10 22:07:27

by S.Çağlar Onur

[permalink] [raw]
Subject: Re: [PATCH] Silent compiler warning introduced by acea6852f32b8805e166d885ed7e9f0c7cd10d41 ([BLUETOOTH]: Move children of connection device to NULL before connection down.)

Hi;

10 Şub 2008 Paz tarihinde, Linus Torvalds şunları yazmıştı:
>
> On Sun, 10 Feb 2008, S.Çağlar Onur wrote:
> > > >
> > > > - while (dev = device_find_child(&conn->dev, NULL, __match_tty)) {
> > > > + while ((dev = device_find_child(&conn->dev, NULL, __match_tty)) != NULL) {
> > > >
> > > Why do you need '!= NULL'?
> >
> > I thought its more readable than
> >
> > while ((dev = device_find_child(&conn->dev, NULL, __match_tty))) {
>
> Yes indeed. I hate the idiotic "double parenthesis without any meaning".
> I'd much rather see "((..) != NULL)" than "((..))", because the latter is
> totally meaningless semantically (although gcc gives it semantics).

But you still not merged this one :), is there any problem exists or would you prefer this comes from with a subsystem tree (which means i'm doing wrong thing with sending these trivial patches to you)?

Cheers
--
S.Çağlar Onur <[email protected]>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!

2008-02-11 12:53:43

by Stefan Richter

[permalink] [raw]
Subject: Re: [PATCH] Silent compiler warning introduced by acea6852f32b8805e166d885ed7e9f0c7cd10d41 ([BLUETOOTH]: Move children of connection device to NULL before connection down.)

S.Çağlar Onur wrote:
> But you still not merged this one :), is there any problem exists or
> would you prefer this comes from with a subsystem tree

I don't know exactly what Linus prefers, but I think the guidelines in
Documentation/SubmittingPatches, sections "Select e-mail destination"
and "Select your CC (e-mail carbon copy) list" adequately answer your
question.
--
Stefan Richter
-=====-==--- --=- -=-==
http://arcgraph.de/sr/