modem/alt1250: Fix 'inst' may be used uninitialized

In function 'unlock_evtbufinst',
    inlined from 'parse_altcompkt' at modem/alt1250/alt1250.c:919:7,
    inlined from 'altcom_recvthread' at modem/alt1250/alt1250.c:968:21:
Error: modem/alt1250/alt1250.c:385:3: error: 'inst' may be used uninitialized [-Werror=maybe-uninitialized]
  385 |   nxmutex_unlock(&inst->stat_lock);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modem/alt1250/alt1250.c: In function 'altcom_recvthread':
modem/alt1250/alt1250.c:822:26: note: 'inst' was declared here
  822 |   FAR alt_evtbuf_inst_t *inst;
      |                          ^~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-12-18 19:18:30 +08:00 committed by archer
parent e42780bb0f
commit 0d0867484a
1 changed files with 2 additions and 2 deletions

View File

@ -819,7 +819,7 @@ static int parse_altcompkt(FAR struct alt1250_dev_s *dev, FAR uint8_t *pkt,
uint16_t cid = parse_cid(h);
uint16_t tid = parse_tid(h);
parse_handler_t parser;
FAR alt_evtbuf_inst_t *inst;
FAR alt_evtbuf_inst_t *inst = NULL;
FAR void **outparam;
size_t outparamlen;
@ -912,7 +912,7 @@ static int parse_altcompkt(FAR struct alt1250_dev_s *dev, FAR uint8_t *pkt,
*bitmap = ALT1250_EVTBIT_REPLY;
}
}
else
else if (inst != NULL)
{
/* Unlock outparam because it has been updated. */