[ofw] __cleanup_cep() oddity

Leonid Keller leonid at mellanox.co.il
Sat Dec 5 12:33:27 PST 2009


Seems like it is superfluous sanity check.
But it is better to set ASSERT and to return p_cep->ref_cnt.

> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org 
> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Sean Hefty
> Sent: Friday, December 04, 2009 1:06 AM
> To: ofw at lists.openfabrics.org
> Subject: [ofw] __cleanup_cep() oddity
> 
> __cleanup_cep() in al_cm_cep.c has the following fragment:
> 
> 	/* If we've already come through here, we're done. */
> 	if( p_cep->state == CEP_STATE_DESTROY ||
> 		p_cep->state == CEP_STATE_DREQ_DESTROY )
> 	{
> 		AL_EXIT( AL_DBG_CM );
> 		return -1;
> 	}
> 
> Does anyone know *why* this check is here returns -1?
> 
> The other return path from this call decrements 
> p_cep->ref_cnt and returns that as the result.  This is used 
> in a couple of places to determine whether or not the destroy 
> callback should be invoked.
> 
> It seems odd that the code allows calling cleanup twice, with 
> different behavior and meaning to the return value.
> 
> - Sean
> 
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
> 



More information about the ofw mailing list