drivers/sensors/apds9960.c: Initial state of allocated structure was not being set. Noted by Leif Jacob.
This commit is contained in:
parent
40be068528
commit
49b2b74105
|
@ -1177,7 +1177,7 @@ int ft5x06_register(FAR struct i2c_master_s *i2c,
|
|||
priv = (FAR struct ft5x06_dev_s *)kmm_zalloc(sizeof(struct ft5x06_dev_s));
|
||||
if (!priv)
|
||||
{
|
||||
ierr("ERROR: kmm_malloc(%d) failed\n", sizeof(struct ft5x06_dev_s));
|
||||
ierr("ERROR: kmm_zalloc(%d) failed\n", sizeof(struct ft5x06_dev_s));
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
|
|
@ -1251,7 +1251,7 @@ int apds9960_register(FAR const char *devpath,
|
|||
/* Initialize the APDS9960 device structure */
|
||||
|
||||
FAR struct apds9960_dev_s *priv =
|
||||
(FAR struct apds9960_dev_s *)kmm_malloc(sizeof(struct apds9960_dev_s));
|
||||
(FAR struct apds9960_dev_s *)kmm_zalloc(sizeof(struct apds9960_dev_s));
|
||||
|
||||
if (priv == NULL)
|
||||
{
|
||||
|
@ -1260,7 +1260,6 @@ int apds9960_register(FAR const char *devpath,
|
|||
}
|
||||
|
||||
priv->config = config;
|
||||
priv->work.worker = NULL;
|
||||
priv->gesture_motion = DIR_NONE;
|
||||
nxsem_init(&priv->sample_sem, 0, 0);
|
||||
|
||||
|
|
|
@ -1460,7 +1460,7 @@ int nrf24l01_register(FAR struct spi_dev_s *spi,
|
|||
|
||||
DEBUGASSERT((spi != NULL) & (cfg != NULL));
|
||||
|
||||
if ((dev = kmm_malloc(sizeof(struct nrf24l01_dev_s))) == NULL)
|
||||
if ((dev = kmm_zalloc(sizeof(struct nrf24l01_dev_s))) == NULL)
|
||||
{
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -1469,16 +1469,9 @@ int nrf24l01_register(FAR struct spi_dev_s *spi,
|
|||
dev->config = cfg;
|
||||
|
||||
dev->state = ST_UNKNOWN;
|
||||
dev->en_aa = 0;
|
||||
dev->ce_enabled = false;
|
||||
|
||||
nxsem_init(&(dev->devsem), 0, 1);
|
||||
dev->nopens = 0;
|
||||
|
||||
#ifndef CONFIG_DISABLE_POLL
|
||||
dev->pfd = NULL;
|
||||
#endif
|
||||
|
||||
nxsem_init(&dev->sem_tx, 0, 0);
|
||||
nxsem_setprotocol(&dev->sem_tx, SEM_PRIO_NONE);
|
||||
|
||||
|
@ -1490,10 +1483,6 @@ int nrf24l01_register(FAR struct spi_dev_s *spi,
|
|||
}
|
||||
|
||||
dev->rx_fifo = rx_fifo;
|
||||
dev->nxt_read = 0;
|
||||
dev->nxt_write = 0;
|
||||
dev->fifo_len = 0;
|
||||
dev->irq_work.worker = 0;
|
||||
|
||||
nxsem_init(&(dev->sem_fifo), 0, 1);
|
||||
nxsem_init(&(dev->sem_rx), 0, 0);
|
||||
|
|
Loading…
Reference in New Issue