[ofw] __cleanup_cep() oddity

Sean Hefty sean.hefty at intel.com
Thu Dec 3 15:06:20 PST 2009


__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




More information about the ofw mailing list