[ofa-general] Re: [PATCHv2] opensm/osm_ucast_lash.(h c): Replace memory allocation by array

Sasha Khapyorsky sashak at voltaire.com
Thu Jun 18 05:31:03 PDT 2009


On 07:31 Thu 18 Jun     , Hal Rosenstock wrote:
> 
> lash's num_mst_in_lane array is indexed by lane nuber, not by switch index.
> Since it's a small number, get rid of extra memory allocation.
> 
> Signed-off-by: Robert Pearson <rpearson at systemfabricworks.com>
> Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>

Applied. Thanks. Tiny comment is below.

> @@ -778,11 +776,8 @@ static int init_lash_structures(lash_t * p_lash)
>  	}
>  
>  	/* initialise num_mst_in_lane[num_switches], default 0 */
> -	p_lash->num_mst_in_lane = (int *)malloc(num_switches * sizeof(int));
> -	if (p_lash->num_mst_in_lane == NULL)
> -		goto Exit_Mem_Error;
>  	memset(p_lash->num_mst_in_lane, 0,
> -	       num_switches * sizeof(p_lash->num_mst_in_lane[0]));
> +	       IB_MAX_NUM_VLS * sizeof(p_lash->num_mst_in_lane[0]));

sizeof(p_lash->num_mst_in_line) would be even simpler, but it is minor.

Sasha



More information about the general mailing list