Call kmm_zalloc instead of kmm_malloc and memsest

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-11-09 18:17:01 +08:00 committed by Masayuki Ishikawa
parent 14c3bc3b8c
commit a026dbaece
5 changed files with 7 additions and 21 deletions

View File

@ -632,7 +632,7 @@ static int cxd56_geofence_register(const char *devpath)
struct cxd56_geofence_dev_s *priv;
int ret;
priv = (struct cxd56_geofence_dev_s *)kmm_malloc(
priv = (struct cxd56_geofence_dev_s *)kmm_zalloc(
sizeof(struct cxd56_geofence_dev_s));
if (!priv)
{
@ -640,7 +640,6 @@ static int cxd56_geofence_register(const char *devpath)
return -ENOMEM;
}
memset(priv, 0, sizeof(struct cxd56_geofence_dev_s));
nxmutex_init(&priv->devlock);
ret = cxd56_geofence_initialize(priv);

View File

@ -3111,7 +3111,7 @@ static int cxd56_gnss_register(const char *devpath)
}
};
priv = (struct cxd56_gnss_dev_s *)kmm_malloc(
priv = (struct cxd56_gnss_dev_s *)kmm_zalloc(
sizeof(struct cxd56_gnss_dev_s));
if (!priv)
{
@ -3119,8 +3119,6 @@ static int cxd56_gnss_register(const char *devpath)
return -ENOMEM;
}
memset(priv, 0, sizeof(struct cxd56_gnss_dev_s));
ret = nxmutex_init(&priv->devlock);
if (ret < 0)
{

View File

@ -1785,17 +1785,14 @@ static struct seq_s *seq_new(void)
leave_critical_section(flags);
seq = (struct seq_s *)kmm_malloc(sizeof(struct seq_s));
seq = (struct seq_s *)kmm_zalloc(sizeof(struct seq_s));
if (!seq)
{
seq_free(sid);
return NULL;
}
memset(seq, 0, sizeof(struct seq_s));
seq->id = sid;
return seq;
}
@ -1828,17 +1825,14 @@ static struct seq_s *deci_new(void)
leave_critical_section(flags);
deci = (struct decimator_s *)kmm_malloc(sizeof(struct decimator_s));
deci = (struct decimator_s *)kmm_zalloc(sizeof(struct decimator_s));
if (!deci)
{
deci_free(sid);
return NULL;
}
memset(deci, 0, sizeof(struct decimator_s));
deci->seq.id = sid;
return &deci->seq;
}
@ -1886,14 +1880,12 @@ static int seq_fifoinit(struct seq_s *seq, int fifoid, uint16_t fsize)
}
}
fifo = (struct scufifo_s *)kmm_malloc(sizeof(struct scufifo_s));
fifo = (struct scufifo_s *)kmm_zalloc(sizeof(struct scufifo_s));
if (!fifo)
{
return -ENOMEM;
}
memset(fifo, 0, sizeof(struct scufifo_s));
/* Setup FIFO, normal FIFO wid and rid are based on 8 and 4 respectively. */
start = scufifo_memalloc(fsize);

View File

@ -493,13 +493,11 @@ struct adc_dev_s *lc823450_adcinitialize(void)
{
ainfo("Initializing ADC driver\n");
if ((inst = kmm_malloc(sizeof(struct lc823450_adc_inst_s))) == NULL)
if ((inst = kmm_zalloc(sizeof(struct lc823450_adc_inst_s))) == NULL)
{
return NULL;
}
memset(inst, 0, sizeof(struct lc823450_adc_inst_s));
/* Initialize driver instance */
inst->dev.ad_ops = &lc823450_adc_ops;

View File

@ -2332,14 +2332,13 @@ static struct usbdev_req_s *sam_ep_allocreq(struct usbdev_ep_s *ep)
usbtrace(TRACE_EPALLOCREQ, USB_EPNO(ep->eplog));
privreq = (struct sam_req_s *)kmm_malloc(sizeof(struct sam_req_s));
privreq = (struct sam_req_s *)kmm_zalloc(sizeof(struct sam_req_s));
if (!privreq)
{
usbtrace(TRACE_DEVERROR(SAM_TRACEERR_ALLOCFAIL), 0);
return NULL;
}
memset(privreq, 0, sizeof(struct sam_req_s));
return &privreq->req;
}