bts-rbs2k: Simplify osmo_fsm_inst_alloc_child_id()

Change-Id: I5344161e5a65ae9959684f0fda7f8b06cbb447f3
This commit is contained in:
Pau Espin 2023-03-30 16:11:53 +02:00
parent d38ccedad7
commit 27195c50a0
1 changed files with 4 additions and 13 deletions

View File

@ -68,20 +68,11 @@ struct osmo_fsm_inst *osmo_fsm_inst_alloc_child_id(struct osmo_fsm *fsm,
{
struct osmo_fsm_inst *fi;
fi = osmo_fsm_inst_alloc(fsm, parent, NULL, parent->log_level,
id ? id : parent->id);
if (!fi) {
/* indicate immediate termination to caller */
osmo_fsm_inst_dispatch(parent, parent_term_event, NULL);
fi = osmo_fsm_inst_alloc_child(fsm, parent, parent_term_event);
if (!fi)
return NULL;
}
LOGPFSM(fi, "is child of %s\n", osmo_fsm_inst_name(parent));
fi->proc.parent = parent;
fi->proc.parent_term_event = parent_term_event;
llist_add(&fi->proc.child, &parent->proc.children);
if (id)
osmo_fsm_inst_update_id_f_sanitize(fi, '-', id);
return fi;
}