Skip to contentSkip to conversation

S2io: two branches the same in wait_for_cmd_complete()

PATCH In review Roel Kluin 4 participants 5 messages Jan 17, 2010 – Jan 19, 2010

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 S2io: two branches the same in wait_for_cmd_complete()

Regardless of the bit_state, the branches execute the same code.

---
 drivers/net/s2io.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

Maybe something else was intended?
this was introduced in commit 9fc93a41a1ad11

drivers/net/s2io.c +3 -10
index cc42186..0e353d6 100644
@@ -3415,16 +3415,9 @@ static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit,
 
 	do {
 		val64 = readq(addr);
-		if (bit_state == S2IO_BIT_RESET) {
-			if (!(val64 & busy_bit)) {
-				ret = SUCCESS;
-				break;
-			}
-		} else {
-			if (!(val64 & busy_bit)) {
-				ret = SUCCESS;
-				break;
-			}
+		if (!(val64 & busy_bit)) {
+			ret = SUCCESS;
+			break;
 		}
 
 		if (in_interrupt())
maintainer
#1 lore raw

From: Roel Kluin <[email protected]>
Date: Sun, 17 Jan 2010 16:10:04 +0100

Quoted 9 lines

Regardless of the bit_state, the branches execute the same code.

---
 drivers/net/s2io.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

Maybe something else was intended?
this was introduced in commit 9fc93a41a1ad11

If you know the guilty commit, at least do the author(s) of commit and/or the driver maintainer(s) the courtesy of CC:'ing them on patches like this.

I've fixed this up here in my reply.

Quoted 24 lines
drivers/net/s2io.c +3 -10
index cc42186..0e353d6 100644
@@ -3415,16 +3415,9 @@ static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit,
 
 	do {
 		val64 = readq(addr);
-		if (bit_state == S2IO_BIT_RESET) {
-			if (!(val64 & busy_bit)) {
-				ret = SUCCESS;
-				break;
-			}
-		} else {
-			if (!(val64 & busy_bit)) {
-				ret = SUCCESS;
-				break;
-			}
+		if (!(val64 & busy_bit)) {
+			ret = SUCCESS;
+			break;
 		}
 
 		if (in_interrupt())
#2 lore raw
Quoted 9 lines · David Miller

From: Roel Kluin <[email protected]>
Date: Sun, 17 Jan 2010 16:10:04 +0100

Quoted 7 lines

Regardless of the bit_state, the branches execute the same code.

---
 drivers/net/s2io.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

Maybe something else was intended?
this was introduced in commit 9fc93a41a1ad11

Quoted 3 lines

If you know the guilty commit, at least do the author(s) of commit and/or the driver maintainer(s) the courtesy of CC:'ing them on patches like this.

One way to do that is to use:

$ ./scripts/get_maintainer.pl --git-blame <patch>
#3 lore raw
In reply to Roel Kluin
Quoted 34 lines

Regardless of the bit_state, the branches execute the same code.

---
 drivers/net/s2io.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

Maybe something else was intended?
this was introduced in commit 9fc93a41a1ad11

drivers/net/s2io.c +3 -10
index cc42186..0e353d6 100644
@@ -3415,16 +3415,9 @@ static int wait_for_cmd_complete(void __iomem
 *addr, u64 busy_bit,
 
 	do {
 		val64 = readq(addr);
-		if (bit_state == S2IO_BIT_RESET) {
-			if (!(val64 & busy_bit)) {
-				ret = SUCCESS;
-				break;
-			}
-		} else {
-			if (!(val64 & busy_bit)) {
-				ret = SUCCESS;
-				break;
-			}
+		if (!(val64 & busy_bit)) {
+			ret = SUCCESS;
+			break;
 		}
 
Quoted 2 lines

if (in_interrupt())
--

Thanks for catching this bug. The fix should be as follows -

drivers/net/s2io.c +0 -0
@@ -3421,7 +3421,7 @@ static int wait_for_cmd_complete(void __iomem

*addr, u64 busy_bit,

                                break;
                        }
                } else {
-                       if (!(val64 & busy_bit)) {
+                       if (val64 & busy_bit) {
                                ret = SUCCESS;
                                break;
                        }

We've not hit this bug because wait_for_cmd_complete() is always called with S2IO_BIT_RESET.

Ram

maintainer
#4 lore raw

From: "Ramkrishna Vepa" <[email protected]>
Date: Mon, 18 Jan 2010 02:20:06 -0500

Quoted 1 line

Thanks for catching this bug. The fix should be as follows -

This doesn't apply to net-2.6, and I'd need your signoff too.

Please fix this up and resubmit, thanks.