mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Reanem kzalloc to kmm_zalloc for consistency
This commit is contained in:
@@ -831,10 +831,10 @@ FAR struct audio_lowerhalf_s *audio_null_initialize(void)
|
||||
|
||||
/* Allocate the null audio device structure */
|
||||
|
||||
priv = (FAR struct null_dev_s *)kzalloc(sizeof(struct null_dev_s));
|
||||
priv = (FAR struct null_dev_s *)kmm_zalloc(sizeof(struct null_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the null audio device structure. Since we used kzalloc,
|
||||
/* Initialize the null audio device structure. Since we used kmm_zalloc,
|
||||
* only the non-zero elements of the structure need to be initialized.
|
||||
*/
|
||||
|
||||
|
||||
@@ -413,7 +413,7 @@ int i2schar_register(FAR struct i2s_dev_s *i2s, int minor)
|
||||
|
||||
/* Allocate a I2S character device structure */
|
||||
|
||||
priv = (FAR struct i2schar_dev_s *)kzalloc(sizeof(struct i2schar_dev_s));
|
||||
priv = (FAR struct i2schar_dev_s *)kmm_zalloc(sizeof(struct i2schar_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the I2S character device structure */
|
||||
|
||||
@@ -2470,10 +2470,10 @@ FAR struct audio_lowerhalf_s *
|
||||
|
||||
/* Allocate a WM8904 device structure */
|
||||
|
||||
priv = (FAR struct wm8904_dev_s *)kzalloc(sizeof(struct wm8904_dev_s));
|
||||
priv = (FAR struct wm8904_dev_s *)kmm_zalloc(sizeof(struct wm8904_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the WM8904 device structure. Since we used kzalloc,
|
||||
/* Initialize the WM8904 device structure. Since we used kmm_zalloc,
|
||||
* only the non-zero elements of the structure need to be initialized.
|
||||
*/
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
|
||||
|
||||
/* Allocate the BCH state structure */
|
||||
|
||||
bch = (FAR struct bchlib_s*)kzalloc(sizeof(struct bchlib_s));
|
||||
bch = (FAR struct bchlib_s*)kmm_zalloc(sizeof(struct bchlib_s));
|
||||
if (!bch)
|
||||
{
|
||||
fdbg("Failed to allocate BCH structure\n");
|
||||
|
||||
+3
-3
@@ -1745,7 +1745,7 @@ static int mxt_hwinitialize(FAR struct mxt_dev_s *priv)
|
||||
|
||||
/* Allocate memory for the object table */
|
||||
|
||||
priv->objtab = kzalloc(info->nobjects * sizeof(struct mxt_object_s));
|
||||
priv->objtab = kmm_zalloc(info->nobjects * sizeof(struct mxt_object_s));
|
||||
if (priv->objtab == NULL)
|
||||
{
|
||||
idbg("ERROR: Failed to allocate object table\n");
|
||||
@@ -1807,7 +1807,7 @@ static int mxt_hwinitialize(FAR struct mxt_dev_s *priv)
|
||||
/* Allocate a place to hold sample data for each slot */
|
||||
|
||||
priv->sample = (FAR struct mxt_sample_s *)
|
||||
kzalloc(nslots * sizeof(struct mxt_sample_s));
|
||||
kmm_zalloc(nslots * sizeof(struct mxt_sample_s));
|
||||
if (priv->sample == NULL)
|
||||
{
|
||||
idbg("ERROR: Failed to allocate object table\n");
|
||||
@@ -1863,7 +1863,7 @@ int mxt_register(FAR struct i2c_dev_s *i2c,
|
||||
|
||||
/* Create and initialize a maXTouch device driver instance */
|
||||
|
||||
priv = (FAR struct mxt_dev_s *)kzalloc(sizeof(struct mxt_dev_s));
|
||||
priv = (FAR struct mxt_dev_s *)kmm_zalloc(sizeof(struct mxt_dev_s));
|
||||
if (priv == NULL)
|
||||
{
|
||||
idbg("ERROR: Failed allocate device structure\n");
|
||||
|
||||
@@ -297,7 +297,7 @@ STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_dev_s *dev,
|
||||
/* Allocate the device state structure */
|
||||
|
||||
#ifdef CONFIG_STMPE811_MULTIPLE
|
||||
priv = (FAR struct stmpe811_dev_s *)kzalloc(sizeof(struct stmpe811_dev_s));
|
||||
priv = (FAR struct stmpe811_dev_s *)kmm_zalloc(sizeof(struct stmpe811_dev_s));
|
||||
if (!priv)
|
||||
{
|
||||
return NULL;
|
||||
|
||||
+1
-1
@@ -381,7 +381,7 @@ int losetup(const char *devname, const char *filename, uint16_t sectsize,
|
||||
|
||||
/* Allocate a loop device structure */
|
||||
|
||||
dev = (FAR struct loop_struct_s *)kzalloc(sizeof(struct loop_struct_s));
|
||||
dev = (FAR struct loop_struct_s *)kmm_zalloc(sizeof(struct loop_struct_s));
|
||||
if (!dev)
|
||||
{
|
||||
return -ENOMEM;
|
||||
|
||||
+2
-2
@@ -674,11 +674,11 @@ FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev)
|
||||
* to be extended to handle multiple FLASH parts on the same SPI bus.
|
||||
*/
|
||||
|
||||
priv = (FAR struct at25_dev_s *)kzalloc(sizeof(struct at25_dev_s));
|
||||
priv = (FAR struct at25_dev_s *)kmm_zalloc(sizeof(struct at25_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the allocated structure (unsupported methods were
|
||||
* nullified by kzalloc).
|
||||
* nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
priv->mtd.erase = at25_erase;
|
||||
|
||||
@@ -827,11 +827,11 @@ FAR struct mtd_dev_s *at45db_initialize(FAR struct spi_dev_s *spi)
|
||||
* to be extended to handle multiple FLASH parts on the same SPI bus.
|
||||
*/
|
||||
|
||||
priv = (FAR struct at45db_dev_s *)kzalloc(sizeof(struct at45db_dev_s));
|
||||
priv = (FAR struct at45db_dev_s *)kmm_zalloc(sizeof(struct at45db_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the allocated structure. (unsupported methods were
|
||||
* nullified by kzalloc).
|
||||
* nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
priv->mtd.erase = at45db_erase;
|
||||
|
||||
+2
-2
@@ -998,11 +998,11 @@ FAR struct mtd_dev_s *m25p_initialize(FAR struct spi_dev_s *dev)
|
||||
* to be extended to handle multiple FLASH parts on the same SPI bus.
|
||||
*/
|
||||
|
||||
priv = (FAR struct m25p_dev_s *)kzalloc(sizeof(struct m25p_dev_s));
|
||||
priv = (FAR struct m25p_dev_s *)kmm_zalloc(sizeof(struct m25p_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the allocated structure. (unsupported methods were
|
||||
* nullified by kzalloc).
|
||||
* nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
priv->mtd.erase = m25p_erase;
|
||||
|
||||
@@ -952,7 +952,7 @@ FAR struct mtd_dev_s *nand_initialize(FAR struct nand_raw_s *raw)
|
||||
|
||||
/* Allocate an NAND MTD device structure */
|
||||
|
||||
nand = (FAR struct nand_dev_s *)kzalloc(sizeof(struct nand_dev_s));
|
||||
nand = (FAR struct nand_dev_s *)kmm_zalloc(sizeof(struct nand_dev_s));
|
||||
if (!nand)
|
||||
{
|
||||
fdbg("ERROR: Failed to allocate the NAND MTD device structure\n");
|
||||
|
||||
@@ -495,7 +495,7 @@ static int part_procfs_open(FAR struct file *filep, FAR const char *relpath,
|
||||
|
||||
/* Allocate a container to hold the task and attribute selection */
|
||||
|
||||
attr = (FAR struct part_procfs_file_s *)kzalloc(sizeof(struct part_procfs_file_s));
|
||||
attr = (FAR struct part_procfs_file_s *)kmm_zalloc(sizeof(struct part_procfs_file_s));
|
||||
if (!attr)
|
||||
{
|
||||
fdbg("ERROR: Failed to allocate file attributes\n");
|
||||
@@ -711,7 +711,7 @@ static int part_procfs_dup(FAR const struct file *oldp, FAR struct file *newp)
|
||||
|
||||
/* Allocate a new container to hold the task and attribute selection */
|
||||
|
||||
newattr = (FAR struct part_procfs_file_s *)kzalloc(sizeof(struct part_procfs_file_s));
|
||||
newattr = (FAR struct part_procfs_file_s *)kmm_zalloc(sizeof(struct part_procfs_file_s));
|
||||
if (!newattr)
|
||||
{
|
||||
fdbg("ERROR: Failed to allocate file attributes\n");
|
||||
@@ -833,7 +833,7 @@ FAR struct mtd_dev_s *mtd_partition(FAR struct mtd_dev_s *mtd, off_t firstblock,
|
||||
|
||||
/* Allocate a partition device structure */
|
||||
|
||||
part = (FAR struct mtd_partition_s *)kzalloc(sizeof(struct mtd_partition_s));
|
||||
part = (FAR struct mtd_partition_s *)kmm_zalloc(sizeof(struct mtd_partition_s));
|
||||
if (!part)
|
||||
{
|
||||
fdbg("ERROR: Failed to allocate memory for the partition device\n");
|
||||
@@ -841,7 +841,7 @@ FAR struct mtd_dev_s *mtd_partition(FAR struct mtd_dev_s *mtd, off_t firstblock,
|
||||
}
|
||||
|
||||
/* Initialize the partition device structure. (unsupported methods were
|
||||
* nullified by kzalloc).
|
||||
* nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
part->child.erase = part_erase;
|
||||
|
||||
@@ -156,7 +156,7 @@ static int mtd_open(FAR struct file *filep, FAR const char *relpath,
|
||||
|
||||
/* Allocate a context structure */
|
||||
|
||||
attr = (FAR struct mtd_file_s *)kzalloc(sizeof(struct mtd_file_s));
|
||||
attr = (FAR struct mtd_file_s *)kmm_zalloc(sizeof(struct mtd_file_s));
|
||||
if (!attr)
|
||||
{
|
||||
fdbg("ERROR: Failed to allocate file attributes\n");
|
||||
@@ -276,7 +276,7 @@ static int mtd_dup(FAR const struct file *oldp, FAR struct file *newp)
|
||||
|
||||
/* Allocate a new container to hold the task and attribute selection */
|
||||
|
||||
newattr = (FAR struct mtd_file_s *)kzalloc(sizeof(struct mtd_file_s));
|
||||
newattr = (FAR struct mtd_file_s *)kmm_zalloc(sizeof(struct mtd_file_s));
|
||||
if (!newattr)
|
||||
{
|
||||
fdbg("ERROR: Failed to allocate file attributes\n");
|
||||
|
||||
@@ -356,11 +356,11 @@ FAR struct mtd_dev_s *mtd_rwb_initialize(FAR struct mtd_dev_s *mtd)
|
||||
* to be extended to handle multiple FLASH parts on the same SPI bus.
|
||||
*/
|
||||
|
||||
priv = (FAR struct mtd_rwbuffer_s *)kzalloc(sizeof(struct mtd_rwbuffer_s));
|
||||
priv = (FAR struct mtd_rwbuffer_s *)kmm_zalloc(sizeof(struct mtd_rwbuffer_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the allocated structure. (unsupported methods/fields
|
||||
* were already nullified by kzalloc).
|
||||
* were already nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
priv->mtd.erase = mtd_erase; /* Our MTD erase method */
|
||||
|
||||
@@ -443,7 +443,7 @@ FAR struct mtd_dev_s *rammtd_initialize(FAR uint8_t *start, size_t size)
|
||||
|
||||
/* Create an instance of the RAM MTD device state structure */
|
||||
|
||||
priv = (FAR struct ram_dev_s *)kzalloc(sizeof(struct ram_dev_s));
|
||||
priv = (FAR struct ram_dev_s *)kmm_zalloc(sizeof(struct ram_dev_s));
|
||||
if (!priv)
|
||||
{
|
||||
fdbg("Failed to allocate the RAM MTD state structure\n");
|
||||
@@ -460,7 +460,7 @@ FAR struct mtd_dev_s *rammtd_initialize(FAR uint8_t *start, size_t size)
|
||||
}
|
||||
|
||||
/* Perform initialization as necessary. (unsupported methods were
|
||||
* nullified by kzalloc).
|
||||
* nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
priv->mtd.erase = ram_erase;
|
||||
|
||||
@@ -689,11 +689,11 @@ FAR struct mtd_dev_s *ramtron_initialize(FAR struct spi_dev_s *dev)
|
||||
* to be extended to handle multiple FLASH parts on the same SPI bus.
|
||||
*/
|
||||
|
||||
priv = (FAR struct ramtron_dev_s *)kzalloc(sizeof(struct ramtron_dev_s));
|
||||
priv = (FAR struct ramtron_dev_s *)kmm_zalloc(sizeof(struct ramtron_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the allocated structure. (unsupported methods were
|
||||
* nullified by kzalloc).
|
||||
* nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
priv->mtd.erase = ramtron_erase;
|
||||
|
||||
@@ -603,11 +603,11 @@ FAR struct mtd_dev_s *s512_initialize(FAR struct mtd_dev_s *mtd)
|
||||
* to be extended to handle multiple FLASH parts on the same SPI bus.
|
||||
*/
|
||||
|
||||
priv = (FAR struct s512_dev_s *)kzalloc(sizeof(struct s512_dev_s));
|
||||
priv = (FAR struct s512_dev_s *)kmm_zalloc(sizeof(struct s512_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the allocated structure. (unsupported methods/fields
|
||||
* were already nullified by kzalloc).
|
||||
* were already nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
priv->mtd.erase = s512_erase;
|
||||
|
||||
+2
-2
@@ -1203,11 +1203,11 @@ FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev)
|
||||
* to be extended to handle multiple FLASH parts on the same SPI bus.
|
||||
*/
|
||||
|
||||
priv = (FAR struct sst25_dev_s *)kzalloc(sizeof(struct sst25_dev_s));
|
||||
priv = (FAR struct sst25_dev_s *)kmm_zalloc(sizeof(struct sst25_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the allocated structure. (unsupported methods were
|
||||
* nullified by kzalloc).
|
||||
* nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
priv->mtd.erase = sst25_erase;
|
||||
|
||||
@@ -952,11 +952,11 @@ FAR struct mtd_dev_s *sst25xx_initialize(FAR struct spi_dev_s *dev)
|
||||
* to be extended to handle multiple FLASH parts on the same SPI bus.
|
||||
*/
|
||||
|
||||
priv = (FAR struct sst25xx_dev_s *)kzalloc(sizeof(struct sst25xx_dev_s));
|
||||
priv = (FAR struct sst25xx_dev_s *)kmm_zalloc(sizeof(struct sst25xx_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the allocated structure. (unsupported methods were
|
||||
* nullified by kzalloc).
|
||||
* nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
priv->mtd.erase = sst25xx_erase;
|
||||
|
||||
+2
-2
@@ -1135,11 +1135,11 @@ FAR struct mtd_dev_s *w25_initialize(FAR struct spi_dev_s *spi)
|
||||
* to be extended to handle multiple FLASH parts on the same SPI bus.
|
||||
*/
|
||||
|
||||
priv = (FAR struct w25_dev_s *)kzalloc(sizeof(struct w25_dev_s));
|
||||
priv = (FAR struct w25_dev_s *)kmm_zalloc(sizeof(struct w25_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the allocated structure (unsupported methods were
|
||||
* nullified by kzalloc).
|
||||
* nullified by kmm_zalloc).
|
||||
*/
|
||||
|
||||
priv->mtd.erase = w25_erase;
|
||||
|
||||
+1
-1
@@ -982,7 +982,7 @@ static int e1000_probe(uint16_t addr, pci_id_t id)
|
||||
|
||||
/* alloc e1000_dev memory */
|
||||
|
||||
if ((dev = kzalloc(sizeof(struct e1000_dev))) == NULL)
|
||||
if ((dev = kmm_zalloc(sizeof(struct e1000_dev))) == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ FAR struct battery_dev_s *max1704x_initialize(FAR struct i2c_dev_s *i2c,
|
||||
|
||||
/* Initialize the MAX1704x device structure */
|
||||
|
||||
priv = (FAR struct max1704x_dev_s *)kzalloc(sizeof(struct max1704x_dev_s));
|
||||
priv = (FAR struct max1704x_dev_s *)kmm_zalloc(sizeof(struct max1704x_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the MAX1704x device structure */
|
||||
|
||||
+2
-2
@@ -588,14 +588,14 @@ int pwm_register(FAR const char *path, FAR struct pwm_lowerhalf_s *dev)
|
||||
|
||||
/* Allocate the upper-half data structure */
|
||||
|
||||
upper = (FAR struct pwm_upperhalf_s *)kzalloc(sizeof(struct pwm_upperhalf_s));
|
||||
upper = (FAR struct pwm_upperhalf_s *)kmm_zalloc(sizeof(struct pwm_upperhalf_s));
|
||||
if (!upper)
|
||||
{
|
||||
pwmdbg("Allocation failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Initialize the PWM device structure (it was already zeroed by kzalloc()) */
|
||||
/* Initialize the PWM device structure (it was already zeroed by kmm_zalloc()) */
|
||||
|
||||
sem_init(&upper->exclsem, 0, 1);
|
||||
#ifdef CONFIG_PWM_PULSECOUNT
|
||||
|
||||
@@ -382,14 +382,14 @@ int qe_register(FAR const char *devpath, FAR struct qe_lowerhalf_s *lower)
|
||||
|
||||
/* Allocate the upper-half data structure */
|
||||
|
||||
upper = (FAR struct qe_upperhalf_s *)kzalloc(sizeof(struct qe_upperhalf_s));
|
||||
upper = (FAR struct qe_upperhalf_s *)kmm_zalloc(sizeof(struct qe_upperhalf_s));
|
||||
if (!upper)
|
||||
{
|
||||
qedbg("Allocation failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Initialize the PWM device structure (it was already zeroed by kzalloc()) */
|
||||
/* Initialize the PWM device structure (it was already zeroed by kmm_zalloc()) */
|
||||
|
||||
sem_init(&upper->exclsem, 0, 1);
|
||||
upper->lower = lower;
|
||||
|
||||
@@ -654,7 +654,7 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen)
|
||||
|
||||
/* Allocate a RAM logging device structure */
|
||||
|
||||
priv = (struct ramlog_dev_s *)kzalloc(sizeof(struct ramlog_dev_s));
|
||||
priv = (struct ramlog_dev_s *)kmm_zalloc(sizeof(struct ramlog_dev_s));
|
||||
if (priv)
|
||||
{
|
||||
/* Initialize the non-zero values in the RAM logging device structure */
|
||||
|
||||
+2
-2
@@ -481,7 +481,7 @@ FAR void *timer_register(FAR const char *path,
|
||||
/* Allocate the upper-half data structure */
|
||||
|
||||
upper = (FAR struct timer_upperhalf_s *)
|
||||
kzalloc(sizeof(struct timer_upperhalf_s));
|
||||
kmm_zalloc(sizeof(struct timer_upperhalf_s));
|
||||
if (!upper)
|
||||
{
|
||||
tmrdbg("Upper half allocation failed\n");
|
||||
@@ -489,7 +489,7 @@ FAR void *timer_register(FAR const char *path,
|
||||
}
|
||||
|
||||
/* Initialize the timer device structure (it was already zeroed
|
||||
* by kzalloc()).
|
||||
* by kmm_zalloc()).
|
||||
*/
|
||||
|
||||
//sem_init(&upper->exclsem, 0, 1);
|
||||
|
||||
+2
-2
@@ -483,7 +483,7 @@ FAR void *watchdog_register(FAR const char *path,
|
||||
/* Allocate the upper-half data structure */
|
||||
|
||||
upper = (FAR struct watchdog_upperhalf_s *)
|
||||
kzalloc(sizeof(struct watchdog_upperhalf_s));
|
||||
kmm_zalloc(sizeof(struct watchdog_upperhalf_s));
|
||||
if (!upper)
|
||||
{
|
||||
wddbg("Upper half allocation failed\n");
|
||||
@@ -491,7 +491,7 @@ FAR void *watchdog_register(FAR const char *path,
|
||||
}
|
||||
|
||||
/* Initialize the watchdog timer device structure (it was already zeroed
|
||||
* by kzalloc()).
|
||||
* by kmm_zalloc()).
|
||||
*/
|
||||
|
||||
sem_init(&upper->exclsem, 0, 1);
|
||||
|
||||
Reference in New Issue
Block a user