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
This commit is contained in:
parent
de8b170d1a
commit
87e03208af
|
@ -134,7 +134,7 @@ static const struct osmo_tdef_state_timeout mgw_fsm_timeouts[32] = {
|
||||||
[MGW_ST_CRCX_MSC] = {.T = -1004 },
|
[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)
|
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)
|
static void mgw_fsm_crcx_hnb_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
|
||||||
|
@ -206,7 +206,7 @@ static void mgw_fsm_crcx_hnb(struct osmo_fsm_inst *fi, uint32_t event, void *dat
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mgw_fsm_state_chg(MGW_ST_ASSIGN);
|
mgw_fsm_state_chg(fi, MGW_ST_ASSIGN);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
OSMO_ASSERT(false);
|
OSMO_ASSERT(false);
|
||||||
|
@ -237,7 +237,7 @@ static void mgw_fsm_assign(struct osmo_fsm_inst *fi, uint32_t event, void *data)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case MGW_EV_RAB_ASS_RESP:
|
case MGW_EV_RAB_ASS_RESP:
|
||||||
mgw_fsm_state_chg(MGW_ST_MDCX_HNB);
|
mgw_fsm_state_chg(fi, MGW_ST_MDCX_HNB);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
OSMO_ASSERT(false);
|
OSMO_ASSERT(false);
|
||||||
|
@ -325,7 +325,7 @@ static void mgw_fsm_mdcx_hnb(struct osmo_fsm_inst *fi, uint32_t event, void *dat
|
||||||
osmo_fsm_inst_state_chg(fi, MGW_ST_FAILURE, 0, 0);
|
osmo_fsm_inst_state_chg(fi, MGW_ST_FAILURE, 0, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mgw_fsm_state_chg(MGW_ST_CRCX_MSC);
|
mgw_fsm_state_chg(fi, MGW_ST_CRCX_MSC);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
OSMO_ASSERT(false);
|
OSMO_ASSERT(false);
|
||||||
|
@ -725,7 +725,7 @@ int handle_rab_ass_req(struct hnbgw_context_map *map, struct osmo_prim_hdr *oph,
|
||||||
snprintf(fsm_name, sizeof(fsm_name), "mgw-fsm-%u-%u", map->rua_ctx_id, mgw_fsm_priv->rab_id);
|
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);
|
fi = osmo_fsm_inst_alloc(&mgw_fsm, map, mgw_fsm_priv, LOGL_DEBUG, fsm_name);
|
||||||
map->mgw_fi = fi;
|
map->mgw_fi = fi;
|
||||||
mgw_fsm_state_chg(MGW_ST_CRCX_HNB);
|
mgw_fsm_state_chg(fi, MGW_ST_CRCX_HNB);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
|
|
Loading…
Reference in New Issue