[VOL-5465] Fixes for deadlock in TP download request, flow removal resp when FSM disabled, and tpProcResult entry removal on FSM reset

Signed-off-by: bseeniva <balaji.seenivasan@radisys.com>
Change-Id: Ife1b6f5d0b2147a32a4c2a00fac516e75ec35e0f
diff --git a/internal/pkg/avcfg/onu_uni_tp.go b/internal/pkg/avcfg/onu_uni_tp.go
index 0b4a204..a905192 100755
--- a/internal/pkg/avcfg/onu_uni_tp.go
+++ b/internal/pkg/avcfg/onu_uni_tp.go
@@ -290,9 +290,9 @@
 					log.Fields{"device-id": onuTP.deviceID, "uni-id": aUniID})
 
 				onuTP.mutexTPState.Lock()
-				defer onuTP.mutexTPState.Unlock()
 				onuTP.procResult[uniTpKey] = fmt.Errorf("techProfile config aborted: Omci AniSideConfig failed %d on %s",
 					aUniID, onuTP.deviceID)
+				onuTP.mutexTPState.Unlock()
 				//this issue here means that the AniConfigFsm has not finished successfully
 				//which requires to reset it to allow for new usage, e.g. also on a different UNI
 				//(without that it would be reset on device down indication latest)
@@ -906,7 +906,6 @@
 	//deleting a map entry should be safe, even if not existing
 	delete(onuTP.mapUniTpIndication, uniTpKey)
 	delete(onuTP.mapPonAniConfig, uniTpKey)
-	delete(onuTP.procResult, uniTpKey)
 	delete(onuTP.tpProfileExists, uniTpKey)
 	delete(onuTP.tpProfileResetting, uniTpKey)
 }