Garbage collect immediately for PM module if the FSM is already stopped.

Change-Id: I075325bef9059e54d5804176b47a7551d6eaa463
diff --git a/VERSION b/VERSION
index c147335..682753f 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.4-dev283
+2.2.4-dev284
diff --git a/internal/pkg/pmmgr/onu_metrics_manager.go b/internal/pkg/pmmgr/onu_metrics_manager.go
index 066339e..0d61c2d 100755
--- a/internal/pkg/pmmgr/onu_metrics_manager.go
+++ b/internal/pkg/pmmgr/onu_metrics_manager.go
@@ -3978,5 +3978,17 @@
 
 // PrepareForGarbageCollection - remove references to prepare for garbage collection
 func (mm *OnuMetricsManager) PrepareForGarbageCollection(ctx context.Context, aDeviceID string) {
-	logger.Debugw(ctx, "prepare for garbage collection - no action, garbage collection done when PM FSM is stopped", log.Fields{"device-id": aDeviceID})
+	currState := L2PmStNull
+	if mm.PAdaptFsm != nil && mm.PAdaptFsm.PFsm != nil {
+		currState = mm.PAdaptFsm.PFsm.Current()
+	}
+	if currState == L2PmStNull {
+		logger.Infow(ctx, "pm fsm already stopped, safe to garbage collect", log.Fields{"device-id": mm.deviceID})
+		mm.pDeviceHandler = nil
+		mm.pOnuDeviceEntry = nil
+		mm.GarbageCollectionComplete <- true
+		return
+	}
+	logger.Debugw(ctx, "prepare for garbage collection - no action, garbage collection done when PM FSM is stopped",
+		log.Fields{"device-id": aDeviceID, "curr-fsm-state": currState})
 }