pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/28282 )
Change subject: mgw_fsm: Change macro to not use local variables implicitly ......................................................................
mgw_fsm: Change macro to not use local variables implicitly
This is misleading for readers since it may access variables which may be uninitialized or in a wrong state. Furthermore, we want to pass some other variable name in a follow up patch.
This effectively allows the compiler to warn about uninitialized used of a fi var in line 661.
Change-Id: Id694f51bb2918fd27da87b3f4a905727cd7f5de6 --- M src/osmo-hnbgw/mgw_fsm.c 1 file changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/82/28282/1
diff --git a/src/osmo-hnbgw/mgw_fsm.c b/src/osmo-hnbgw/mgw_fsm.c index 5dd613f..2b7484f 100644 --- a/src/osmo-hnbgw/mgw_fsm.c +++ b/src/osmo-hnbgw/mgw_fsm.c @@ -134,7 +134,7 @@ [MGW_ST_CRCX_MSC] = {.T = -1004 }, };
-#define mgw_fsm_state_chg(state) \ +#define mgw_fsm_state_chg(fi, state) \ osmo_tdef_fsm_inst_state_chg(fi, state, mgw_fsm_timeouts, mgw_fsm_T_defs, -1)
static void mgw_fsm_crcx_hnb_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) @@ -206,7 +206,7 @@ return; }
- mgw_fsm_state_chg(MGW_ST_ASSIGN); + mgw_fsm_state_chg(fi, MGW_ST_ASSIGN); return; default: OSMO_ASSERT(false); @@ -237,7 +237,7 @@ { switch (event) { case MGW_EV_RAB_ASS_RESP: - mgw_fsm_state_chg(MGW_ST_MDCX_HNB); + mgw_fsm_state_chg(fi, MGW_ST_MDCX_HNB); return; default: OSMO_ASSERT(false); @@ -325,7 +325,7 @@ osmo_fsm_inst_state_chg(fi, MGW_ST_FAILURE, 0, 0); return; } - mgw_fsm_state_chg(MGW_ST_CRCX_MSC); + mgw_fsm_state_chg(fi, MGW_ST_CRCX_MSC); return; default: OSMO_ASSERT(false); @@ -725,7 +725,7 @@ snprintf(fsm_name, sizeof(fsm_name), "mgw-fsm-%u-%u", map->rua_ctx_id, mgw_fsm_priv->rab_id); fi = osmo_fsm_inst_alloc(&mgw_fsm, map, mgw_fsm_priv, LOGL_DEBUG, fsm_name); map->mgw_fi = fi; - mgw_fsm_state_chg(MGW_ST_CRCX_HNB); + mgw_fsm_state_chg(fi, MGW_ST_CRCX_HNB);
return 0; error: