gprs_ns_instantiate(): propagate errors from gprs_sns_init() to caller

Change-Id: I71f347a2f0376716e5f83d33a7931eb8a99aad77
This commit is contained in:
Harald Welte 2019-12-01 13:38:35 +01:00
parent ae5016f193
commit 797d533072
1 changed files with 7 additions and 2 deletions

View File

@ -1884,13 +1884,18 @@ static bool gprs_sns_fsm_registered = false;
*/
struct gprs_ns_inst *gprs_ns_instantiate(gprs_ns_cb_t *cb, void *ctx)
{
struct gprs_ns_inst *nsi = talloc_zero(ctx, struct gprs_ns_inst);
struct gprs_ns_inst *nsi;
if (!gprs_sns_fsm_registered) {
gprs_sns_init();
int rc = gprs_sns_init();
if (rc < 0)
return NULL;
gprs_sns_fsm_registered = true;
}
nsi = talloc_zero(ctx, struct gprs_ns_inst);
if (!nsi)
return NULL;
nsi->cb = cb;
INIT_LLIST_HEAD(&nsi->gprs_nsvcs);
nsi->timeout[NS_TOUT_TNS_BLOCK] = 3;