[PATCH infiniband-diags] perfquery.c: Fix smp_query_via return value checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



smp_query_via returns pointer so < 0 comparison is wrong:
src/perfquery.c: In function ?is_rsfec_mode_active?:
src/perfquery.c:481: warning: ordered comparison of pointer with integer zero
src/perfquery.c: In function ?main?:
src/perfquery.c:919: warning: ordered comparison of pointer with integer zero
src/perfquery.c:928: warning: ordered comparison of pointer with integer zero
 
Reported-by: David Binderman <dcb314@xxxxxxxxxxx> 
Signed-off-by: Hal Rosenstock <hal@xxxxxxxxxxxx>
---
Fix for OFA Bugzilla #2572

diff --git a/src/perfquery.c b/src/perfquery.c
index 9e3a307..948ce52 100644
--- a/src/perfquery.c
+++ b/src/perfquery.c
@@ -477,8 +477,8 @@ static uint8_t is_rsfec_mode_active(ib_portid_t * portid, int port,
 			return 0;
 		}
 
-		if (smp_query_via(data, portid, IB_ATTR_PORT_INFO_EXT, port, 0,
-				  srcport) < 0)
+		if (!smp_query_via(data, portid, IB_ATTR_PORT_INFO_EXT, port, 0,
+				   srcport))
 			IBEXIT("smp query portinfo extended failed");
 
 		mad_decode_field(data, IB_PORT_EXT_CAPMASK_F, &pie_capmask);
@@ -915,8 +915,8 @@ int main(int argc, char **argv)
 
 
 	if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) {
-		if (smp_query_via(data, &portid, IB_ATTR_NODE_INFO, 0, 0,
-				  srcport) < 0)
+		if (!smp_query_via(data, &portid, IB_ATTR_NODE_INFO, 0, 0,
+				   srcport))
 			IBEXIT("smp query nodeinfo failed");
 		node_type = mad_get_field(data, 0, IB_NODE_TYPE_F);
 		mad_decode_field(data, IB_NODE_NPORTS_F, &num_ports);
@@ -924,8 +924,8 @@ int main(int argc, char **argv)
 			IBEXIT("smp query nodeinfo: num ports invalid");
 
 		if (node_type == IB_NODE_SWITCH) {
-			if (smp_query_via(data, &portid, IB_ATTR_SWITCH_INFO,
-					  0, 0, srcport) < 0)
+			if (!smp_query_via(data, &portid, IB_ATTR_SWITCH_INFO,
+					   0, 0, srcport))
 				IBEXIT("smp query nodeinfo failed");
 			enhancedport0 =
 			    mad_get_field(data, 0, IB_SW_ENHANCED_PORT0_F);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux