Skip to contentSkip to conversation

scsi/be2iscsi: Fix logical-not-parentheses compilation warning

PATCH In review Tomer Barletz 2 participants 4 messages Aug 3, 2015 – Aug 7, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi/be2iscsi: Fix logical-not-parentheses compilation warning

This fixes the following warning seen with GCC v5.1:
warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses].

---
 drivers/scsi/be2iscsi/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/be2iscsi/be_main.c +1 -1
index 7a6dbfb..ff8d40e 100644
@@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address,
 {
 	WARN_ON(!virtual_address);
 	WARN_ON(!physical_address);
-	WARN_ON(!length > 0);
+	WARN_ON(0 == length);
 	WARN_ON(!sgl);
 
 	sgl->va = virtual_address;
Signature · 1 line
2.4.3
Reviewed-by on v1 1/1
#1 lore raw

Ok, it has cost me quite some time to figure out what "!length > 0" is actually doing, but looks ok to me.

Quoted 14 lines · Tomer Barletz

This fixes the following warning seen with GCC v5.1:
warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses].

---
 drivers/scsi/be2iscsi/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/be2iscsi/be_main.c +0 -0
index 7a6dbfb..ff8d40e 100644

drivers/scsi/be2iscsi/be_main.c be_sgl_create_contiguous(void *virtual_address, · line 3187

Quoted 5 lines
drivers/scsi/be2iscsi/be_main.c +1 -1
@@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address,
 {
 	WARN_ON(!virtual_address);
 	WARN_ON(!physical_address);
-	WARN_ON(!length > 0);
+	WARN_ON(0 == length);

Please write WARN_ON(length == 0);

drivers/scsi/be2iscsi/be_main.c be_sgl_create_contiguous(void *virtual_address, · line 3190

Quoted 3 lines
drivers/scsi/be2iscsi/be_main.c +0 -0
 	WARN_ON(!sgl);
 
 	sgl->va = virtual_address;

Given the above is swapped:

Signature · 6 lines
Johannes Thumshirn                                           Storage
[email protected]                                 +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600  D0D0 0393 969D 2D76 0850
#2 lore raw

PATCH 1/1 scsi/be2iscsi: Fix logical-not-parentheses compilation warning

This fixes the following warning seen with GCC v5.1:
warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses].

---
 drivers/scsi/be2iscsi/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/be2iscsi/be_main.c +1 -1
index 7a6dbfb..cf1908e 100644
@@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address,
 {
 	WARN_ON(!virtual_address);
 	WARN_ON(!physical_address);
-	WARN_ON(!length > 0);
+	WARN_ON(length == 0);
 	WARN_ON(!sgl);
 
 	sgl->va = virtual_address;
Signature · 1 line
2.4.3
Reviewed-by on v1 1/1
#3 lore raw
Quoted 14 lines · Tomer Barletz

This fixes the following warning seen with GCC v5.1:
warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses].

---
 drivers/scsi/be2iscsi/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/be2iscsi/be_main.c +0 -0
index 7a6dbfb..cf1908e 100644

drivers/scsi/be2iscsi/be_main.c be_sgl_create_contiguous(void *virtual_address, · line 3190

Quoted 8 lines
drivers/scsi/be2iscsi/be_main.c +1 -1
@@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address,
 {
 	WARN_ON(!virtual_address);
 	WARN_ON(!physical_address);
-	WARN_ON(!length > 0);
+	WARN_ON(length == 0);
 	WARN_ON(!sgl);
 
 	sgl->va = virtual_address;

Looks good.

Signature · 6 lines
Johannes Thumshirn                                           Storage
[email protected]                                 +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600  D0D0 0393 969D 2D76 0850