The overloaded argument 'ptr' was used in a manner that generated compiler
  warnings about possible uninitialized use.  This localizes each use to the
  block that uses it and removes the warning.

Signed-off-by: David A. McMillen <[email protected]>
---
 rdma_bw.c  |    7 +++----
 rdma_lat.c |    7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/rdma_bw.c b/rdma_bw.c
index 2628ac4..18c4244 100755
--- a/rdma_bw.c
+++ b/rdma_bw.c
@@ -510,8 +510,6 @@ err:
 static struct pingpong_context *pp_init_ctx(void *ptr, struct pp_data *data)
 {
        struct pingpong_context *ctx;
-       struct ibv_device *ib_dev;
-       struct rdma_cm_id *cm_id;
 
        ctx = malloc(sizeof *ctx);
        if (!ctx)
@@ -530,7 +528,7 @@ static struct pingpong_context *pp_init_ctx(void *ptr, 
struct pp_data *data)
        memset(ctx->buf, 0, ctx->size * 2);
 
        if (data->use_cma) {
-               cm_id = (struct rdma_cm_id *)ptr;
+               struct rdma_cm_id *cm_id = (struct rdma_cm_id *)ptr;
                ctx->context = cm_id->verbs;
                if (!ctx->context) {
                        fprintf(stderr, "%d:%s: Unbound cm_id!!\n", pid, 
@@ -539,7 +537,7 @@ static struct pingpong_context *pp_init_ctx(void *ptr, 
struct pp_data *data)
                }
                
        } else {
-               ib_dev = (struct ibv_device *)ptr;
+               struct ibv_device *ib_dev = (struct ibv_device *)ptr;
                ctx->context = ibv_open_device(ib_dev);
                if (!ctx->context) {
                        fprintf(stderr, "%d:%s: Couldn't get context for %s\n", 
@@ -603,6 +601,7 @@ static struct pingpong_context *pp_init_ctx(void *ptr, 
struct pp_data *data)
        };
 
        if (data->use_cma) {
+               struct rdma_cm_id *cm_id = (struct rdma_cm_id *)ptr;
                if (rdma_create_qp(cm_id, ctx->pd, &attr)) {
                        fprintf(stderr, "%d:%s: Couldn't create QP\n", pid, 
__func__);
                        return NULL;
diff --git a/rdma_lat.c b/rdma_lat.c
index 3681b35..0c45af8 100755
--- a/rdma_lat.c
+++ b/rdma_lat.c
@@ -523,8 +523,6 @@ static int pp_server_exch_dest(struct pp_data *data)
 static struct pingpong_context *pp_init_ctx(void *ptr, struct pp_data *data)
 {
        struct pingpong_context *ctx;
-       struct ibv_device *ib_dev;
-       struct rdma_cm_id *cm_id;
 
        ctx = malloc(sizeof *ctx);
        if (!ctx)
@@ -547,7 +545,7 @@ static struct pingpong_context *pp_init_ctx(void *ptr, 
struct pp_data *data)
        
 
        if (data->use_cma) {
-               cm_id = (struct rdma_cm_id *)ptr;
+               struct rdma_cm_id *cm_id = (struct rdma_cm_id *)ptr;
                ctx->context = cm_id->verbs;
                if (!ctx->context) {
                        fprintf(stderr, "%d:%s: Unbound cm_id!!\n", pid, 
@@ -556,7 +554,7 @@ static struct pingpong_context *pp_init_ctx(void *ptr, 
struct pp_data *data)
                }
                
        } else {
-               ib_dev = (struct ibv_device *)ptr;
+               struct ibv_device *ib_dev = (struct ibv_device *)ptr;
                ctx->context = ibv_open_device(ib_dev);
                if (!ctx->context) {
                        fprintf(stderr, "%d:%s: Couldn't get context for %s\n", 
@@ -612,6 +610,7 @@ static struct pingpong_context *pp_init_ctx(void *ptr, 
struct pp_data *data)
        };
 
        if (data->use_cma) {
+               struct rdma_cm_id *cm_id = (struct rdma_cm_id *)ptr;
                if (rdma_create_qp(cm_id, ctx->pd, &attr)) {
                        fprintf(stderr, "%d:%s: Couldn't create QP\n", pid, 
__func__);
                        return NULL;
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to