[ofa-general] Re: [PATCH] opensm/osm_sa_mcmember_record.c: Remove uninitialized variable compile warning

Sasha Khapyorsky sashak at voltaire.com
Tue Sep 22 08:38:09 PDT 2009


On 07:42 Tue 22 Sep     , Hal Rosenstock wrote:
> 
> Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
> ---
> diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
> index 8f7816b..7e95622 100644
> --- a/opensm/opensm/osm_sa_mcmember_record.c
> +++ b/opensm/opensm/osm_sa_mcmember_record.c
> @@ -978,7 +978,7 @@ Exit:
>  static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
>  {
>  	osm_mgrp_t *p_mgrp = NULL;
> -	ib_api_status_t status;
> +	ib_api_status_t status = IB_SUCCESS;

This makes sense. However I think about another fix - we don't need to
refer unintialized and not used status value when error response is
generated after osm_mgrp_add_port() failure. IOW:


commit 4dd928b705024c4fefd6435c733ddd885fded5ab
Author: Sasha Khapyorsky <sashak at voltaire.com>
Date:   Tue Sep 22 18:31:13 2009 +0300

    opensm/osm_sa_mcmember_record.c: clean uninitialized variable use
    
    Clean uninitialized variable 'status' use.
    
    Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>

diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index 8f7816b..dd64d94 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
@@ -1167,9 +1167,7 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 		CL_PLOCK_RELEASE(sa->p_lock);
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B06: "
 			"osm_mgrp_add_port failed\n");
-		osm_sa_send_error(sa, p_madw, status == IB_INVALID_PARAMETER ?
-				  IB_SA_MAD_STATUS_REQ_INVALID :
-				  IB_SA_MAD_STATUS_NO_RESOURCES);
+		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}

Sasha



More information about the general mailing list