gen2_basic - fix up some compiler warnings

Create a new CHECK_PVALUE macro for checking pointers and use it where
appropriate.  This makes a bunch of compiler printf warnings go away.

Signed-off by: Robert Walsh <robert.walsh@qlogic.com>

diff -rNu a/gen2_basic/test_cq.c b/gen2_basic/test_cq.c
--- a/gen2_basic/test_cq.c	2006-07-27 13:42:44.857603000 -0700
+++ b/gen2_basic/test_cq.c	2006-08-14 14:17:17.352167000 -0700
@@ -446,13 +447,13 @@
 	TEST_CASE(("illegal comp vector"));
 
 	cq = ibv_create_cq(ib_cont, size, NULL, NULL, -1);
-	CHECK_VALUE("create cq with invalid comp vector", cq, NULL, goto cleanup);
+	CHECK_PVALUE("create cq with invalid comp vector", cq, NULL, goto cleanup);
 
 	cq = ibv_create_cq(ib_cont, size, NULL, NULL, ib_cont->num_comp_vectors);
-	CHECK_VALUE("create cq with invalid comp vector", cq, NULL, goto cleanup);
+	CHECK_PVALUE("create cq with invalid comp vector", cq, NULL, goto cleanup);
 
 	cq = ibv_create_cq(ib_cont, size, NULL, NULL, VL_range(rand_gen, ib_cont->num_comp_vectors + 1, 0xFFFFFFF));
-	CHECK_VALUE("create cq with invalid comp vector", cq, NULL, goto cleanup);
+	CHECK_PVALUE("create cq with invalid comp vector", cq, NULL, goto cleanup);
 
 	PASSED;
 	
@@ -499,7 +500,7 @@
 	size = VL_random(rand_gen, device_attr.max_cqe);
 
 	cq = ibv_create_cq(ib_cont, size, NULL, channel, 0);
-	CHECK_VALUE("create cq with invalid channel", cq, NULL, goto cleanup);
+	CHECK_PVALUE("create cq with invalid channel", cq, NULL, goto cleanup);
 
 	PASSED;
 	
diff -rNu a/gen2_basic/test_poll_post.c b/gen2_basic/test_poll_post.c
--- a/gen2_basic/test_poll_post.c	2006-07-26 17:46:51.753706000 -0700
+++ b/gen2_basic/test_poll_post.c	2006-08-14 14:17:03.705821000 -0700
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
+ * Copyright (c) 2006 QLogic Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -365,10 +366,10 @@
 					CHECK_VALUE("ibv_post_send", rc, -1, goto cleanup);
 
 					for (i = 0; i < num_wr - (attr.cap.max_send_wr % num_wr) - 1; ++i) {
-						CHECK_VALUE("next ptr", bad_wr[i].next, &bad_wr[i + 1], goto cleanup);
+						CHECK_PVALUE("next ptr", bad_wr[i].next, &bad_wr[i + 1], goto cleanup);
 					}
 
-					CHECK_VALUE("last ptr", bad_wr[num_wr - (attr.cap.max_send_wr % num_wr) - 1].next, NULL, goto cleanup);
+					CHECK_PVALUE("last ptr", bad_wr[num_wr - (attr.cap.max_send_wr % num_wr) - 1].next, NULL, goto cleanup);
 				  
 					rc = ibv_destroy_qp(qp);
 					CHECK_VALUE("ibv_destroy_qp", rc, 0, goto cleanup);
@@ -536,10 +537,10 @@
 				CHECK_VALUE("ibv_post_recv", rc, -1, goto cleanup);
 
 				for (i = 0; i < num_wr - (attr.cap.max_recv_wr % num_wr) - 1; ++i) {
-					CHECK_VALUE("next ptr", bad_wr[i].next, &bad_wr[i + 1], goto cleanup);
+					CHECK_PVALUE("next ptr", bad_wr[i].next, &bad_wr[i + 1], goto cleanup);
 				}
 
-				CHECK_VALUE("last ptr", bad_wr[num_wr - (attr.cap.max_recv_wr % num_wr) - 1].next, NULL, goto cleanup);
+				CHECK_PVALUE("last ptr", bad_wr[num_wr - (attr.cap.max_recv_wr % num_wr) - 1].next, NULL, goto cleanup);
 	
 				rc = ibv_destroy_qp(qp);
 				CHECK_VALUE("ibv_destroy_qp", rc, 0, goto cleanup);
diff -rNu gen2_basic/test_qp.c b/gen2_basic/test_qp.c
--- a/gen2_basic/test_qp.c	2006-04-25 11:40:30.668369000 -0700
+++ b/gen2_basic/test_qp.c	2006-08-14 14:16:57.911621000 -0700
@@ -1692,12 +1695,12 @@
 		CHECK_VALUE("max_send_sge", query_init_attr.cap.max_send_sge, attr.cap.max_send_sge, goto cleanup);
 		CHECK_VALUE("max_send_wr", query_init_attr.cap.max_send_wr, attr.cap.max_send_wr, goto cleanup);
 
-		CHECK_VALUE("qp_context", query_init_attr.qp_context, attr.qp_context, goto cleanup);
+		CHECK_PVALUE("qp_context", query_init_attr.qp_context, attr.qp_context, goto cleanup);
 		CHECK_VALUE("qp_type", query_init_attr.qp_type, attr.qp_type, goto cleanup);
-		CHECK_VALUE("recv_cq", query_init_attr.recv_cq, attr.recv_cq, goto cleanup);
-		CHECK_VALUE("send_cq", query_init_attr.send_cq, attr.send_cq, goto cleanup);
+		CHECK_PVALUE("recv_cq", query_init_attr.recv_cq, attr.recv_cq, goto cleanup);
+		CHECK_PVALUE("send_cq", query_init_attr.send_cq, attr.send_cq, goto cleanup);
 		CHECK_VALUE("sq_sig_all", query_init_attr.sq_sig_all, attr.sq_sig_all, goto cleanup);
-		CHECK_VALUE("srq", query_init_attr.srq, attr.srq, goto cleanup);
+		CHECK_PVALUE("srq", query_init_attr.srq, attr.srq, goto cleanup);
 	}
 	PASSED;
 
diff -rNu a/gen2_basic/types.h b/gen2_basic/types.h
--- a/gen2_basic/types.h	2006-01-08 10:59:26.233357000 -0800
+++ b/gen2_basic/types.h	2006-08-14 14:17:21.922587000 -0700
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
+ * Copyright (c) 2006 QLogic Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -108,6 +109,13 @@
 							cmd; 									\
 						 }
 
+#define CHECK_PVALUE(verb, act_val, exp_val, cmd) if ((act_val) != (exp_val)) {							\
+							FAILED;									\
+							VL_MISC_ERR(("Error in %s, expected value %p, actual value %p",	\
+							(verb), (exp_val), (act_val))); 					\
+							cmd; 									\
+						 }
+
 #define CHECK_PTR(verb, ptr, cmd) if (!(ptr)) { 							\
 					FAILED;								\
 					VL_MISC_ERR(("Error in %s, NULL pointer returned", (verb)));	\
