if (crv = CKR_OK) {
if (CKR_OK == crv) {
SECMOD_CancelWait(SECMODModule *mod){    unsigned long controlMask = mod->evControlMask;    SECStatus rv = SECSuccess;    CK_RV crv;    PZ_Lock(mod->refLock);    mod->evControlMask |= SECMOD_END_WAIT;    controlMask = mod->evControlMask;    if (controlMask & SECMOD_WAIT_PKCS11_EVENT) {	/* NOTE: this call will drop all transient keys, in progress	 * operations, and any authentication. This is the only documented	 * way to get WaitForSlotEvent to return. Also note: for non-thread	 * safe tokens, we need to hold the module lock, this is not yet at	 * system shutdown/starup time, so we need to protect these calls */	crv = PK11_GETTAB(mod)->C_Finalize(NULL);	/* ok, we slammed the module down, now we need to reinit it in case	 * we intend to use it again */	if (crv = CKR_OK) {	    secmod_ModuleInit(mod);	} else {	    /* Finalized failed for some reason,  notify the application	     * so maybe it has a prayer of recovering... */	    PORT_SetError(PK11_MapError(crv));	    rv = SECFailure;	}    } else if (controlMask & SECMOD_WAIT_SIMULATED_EVENT) {	mod->evControlMask &= ~SECMOD_WAIT_SIMULATED_EVENT; 				/* Simulated events will eventually timeout				 * and wake up in the loop */    }    PZ_Unlock(mod->refLock);    return rv;}