cosmetic: gscon: don't re-enter ST_CLEARING

I often see "ERROR [ST_CLEARING] Entering ST_CLEARING not permitted!", avoid
the bogus error messages by checking entering ST_CLEARING only if not in it
yet. Still don't allow re-entering, to not restart the timeout.

Change-Id: Ia1f171c08dcbc529f907a20eed43bf5ee3a452b3
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 60a9a75..fd3c293 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -290,7 +290,8 @@
 			       osmo_fsm_inst_state_name(conn->fi));
 		}
 		gscon_bssmap_clear(conn, GSM0808_CAUSE_EQUIPMENT_FAILURE);
-		osmo_fsm_inst_state_chg(fi, ST_CLEARING, 60, 999);
+		if (conn->fi->state != ST_CLEARING)
+			osmo_fsm_inst_state_chg(fi, ST_CLEARING, 60, 999);
 		return;
 	default:
 		OSMO_ASSERT(false);
@@ -626,7 +627,8 @@
 		conn->lchan = NULL;
 	}
 	if (!conn->lchan) {
-		osmo_fsm_inst_state_chg(conn->fi, ST_CLEARING, 60, 999);
+		if (conn->fi->state != ST_CLEARING)
+			osmo_fsm_inst_state_chg(conn->fi, ST_CLEARING, 60, 999);
 		gscon_bssmap_clear(conn, GSM0808_CAUSE_EQUIPMENT_FAILURE);
 	}
 }
@@ -670,7 +672,8 @@
 	switch (event) {
 	case GSCON_EV_A_CLEAR_CMD:
 		/* MSC tells us to cleanly shut down */
-		osmo_fsm_inst_state_chg(fi, ST_CLEARING, 60, 999);
+		if (conn->fi->state != ST_CLEARING)
+			osmo_fsm_inst_state_chg(fi, ST_CLEARING, 60, 999);
 		LOGPFSML(fi, LOGL_DEBUG, "Releasing all lchans (if any) after BSSMAP Clear Command\n");
 		gscon_release_lchans(conn, true);
 		/* FIXME: Release all terestrial resources in ST_CLEARING */