2003-02-07 16:58:46

by Frank Davis

[permalink] [raw]
Subject: [PATCH] 2.5.59 : drivers/char/ip2/i2lib.c

Hello all,
The following patch addresses buzilla bug # 320, and separates 1 test
into 2 separate 2 tests. Please review for inclusion.

Regards,
Frank

--- linux/drivers/char/ip2/i2lib.c.old 2003-01-16 21:22:57.000000000 -0500
+++ linux/drivers/char/ip2/i2lib.c 2003-02-07 02:54:36.000000000 -0500
@@ -1251,7 +1251,7 @@

}
if ( old_flags & STOPFL_FLAG ) {
- if ( 1 == i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL) > 0 ) {
+ if ((1 == i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL)) && (i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL) > 0 )) {
old_flags = 0; // Success - clear flags
}



2003-02-07 17:05:51

by Valdis Klētnieks

[permalink] [raw]
Subject: Re: [PATCH] 2.5.59 : drivers/char/ip2/i2lib.c

On Fri, 07 Feb 2003 12:17:45 EST, Frank Davis said:

> + if ((1 == i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL))
&& (i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL) > 0 )) {

Hmm... if ((1 == A) && (A > 0)) {

Unless i2QueueCommands has a side-effect on being re-evaluated (which isn't
guaranteed to happen), it looks like this can be simplified a bit,
since the '&& (A > 0)' is superfluous.

I think the code started as 'if A == 1' and became 'if A > 0', or vice
versa, and somebody needs to check what's *REALLY* intended...


--
Valdis Kletnieks
Computer Systems Senior Engineer
Virginia Tech


Attachments:
(No filename) (226.00 B)

2003-02-10 01:38:13

by Rusty Russell

[permalink] [raw]
Subject: Re: [PATCH] 2.5.59 : drivers/char/ip2/i2lib.c

In message <Pine.LNX.4.44.0302071214440.6917-100000@master> you write:
> Hello all,
> The following patch addresses buzilla bug # 320, and separates 1 test
> into 2 separate 2 tests. Please review for inclusion.

The old code was nonsensical, so I can't trivially tell if the new
code is right. This has to be done by the author.

With no '@' sign anywhere in the char/ip2 subdirectory, I have no idea
who to send this to 8(

Rusty.

> --- linux/drivers/char/ip2/i2lib.c.old 2003-01-16 21:22:57.000000000 -0500
> +++ linux/drivers/char/ip2/i2lib.c 2003-02-07 02:54:36.000000000 -0500
> @@ -1251,7 +1251,7 @@
>
> }
> if ( old_flags & STOPFL_FLAG ) {
> - if ( 1 == i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL)
> 0 ) {
> + if ((1 == i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL)) && (i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL) > 0 )) {
> old_flags = 0; // Success - clear flags
> }
>
>

--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.