Skip to contentSkip to conversation

qlogicpti: add missing parentheses

PATCH In review Roel Kluin 3 participants 3 messages Nov 3, 2009 – Nov 4, 2009 SCSI

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 qlogicpti: add missing parentheses

+' has a higher precedence than ?' so the condition always evaluates to true and this is preprocessed to `7*((ql) - 1)'

---
 drivers/scsi/qlogicpti.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

This one must be right, I think.

QLOGICPTI_MAX_SG is used here:

drivers/scsi/qlogicpti.c:964: host->sg_tablesize = QLOGICPTI_MAX_SG(num_free);
drivers/scsi/qlogicpti.c:1288: .sg_tablesize = QLOGICPTI_MAX_SG(QLOGICPTI_REQ_QUEUE_LEN),

Thanks, Roel

drivers/scsi/qlogicpti.h +1 -1
index 9c053bb..e3c74d1 100644
@@ -43,7 +43,7 @@
  * determined for each queue request anew.
  */
 #define QLOGICPTI_REQ_QUEUE_LEN	255	/* must be power of two - 1 */
-#define QLOGICPTI_MAX_SG(ql)	(4 + ((ql) > 0) ? 7*((ql) - 1) : 0)
+#define QLOGICPTI_MAX_SG(ql)	(4 + (((ql) > 0) ? 7*((ql) - 1) : 0))
 
 /* mailbox command complete status codes */
 #define MBOX_COMMAND_COMPLETE		0x4000
#1 lore raw
Quoted 9 lines · Roel Kluin

+' has a higher precedence than ?' so the condition always evaluates to true and this is preprocessed to `7*((ql) - 1)'

---
 drivers/scsi/qlogicpti.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

This one must be right, I think.

It looks plausible ... but it will increase the mailbox segment length by 4 ... someone needs to verify that this increase will actually work and won't run off the end of the mailbox table.

James

Acked-by
#2 lore raw

From: James Bottomley <[email protected]>
Date: Tue, 03 Nov 2009 17:51:49 -0600

Quoted 9 lines · Roel Kluin
Quoted 8 lines

+' has a higher precedence than ?' so the condition always evaluates to true and this is preprocessed to `7*((ql) - 1)'

---
 drivers/scsi/qlogicpti.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 5 lines
Quoted 1 line

This one must be right, I think.

It looks plausible ... but it will increase the mailbox segment length by 4 ... someone needs to verify that this increase will actually work and won't run off the end of the mailbox table.

It should be fine, good find Roel.