mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 13:13:08 +08:00
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:
@@ -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. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user