diff options
Diffstat (limited to 'nuttx/drivers')
-rw-r--r-- | nuttx/drivers/net/e1000.c | 1 | ||||
-rw-r--r-- | nuttx/drivers/pwm.c | 7 | ||||
-rw-r--r-- | nuttx/drivers/sensors/lm75.c | 8 | ||||
-rw-r--r-- | nuttx/drivers/sensors/qencoder.c | 7 | ||||
-rw-r--r-- | nuttx/drivers/usbdev/usbmsc.c | 2 |
5 files changed, 15 insertions, 10 deletions
diff --git a/nuttx/drivers/net/e1000.c b/nuttx/drivers/net/e1000.c index cae6f39b4..e894a1dd2 100644 --- a/nuttx/drivers/net/e1000.c +++ b/nuttx/drivers/net/e1000.c @@ -52,6 +52,7 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> +#include <nuttx/kmalloc.h> #include <nuttx/net/uip/uip.h> #include <nuttx/net/uip/uip-arp.h> diff --git a/nuttx/drivers/pwm.c b/nuttx/drivers/pwm.c index 62fb4d2fb..6e33c902b 100644 --- a/nuttx/drivers/pwm.c +++ b/nuttx/drivers/pwm.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/pwm.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,7 @@ #include <errno.h> #include <debug.h> +#include <nuttx/kmalloc.h> #include <nuttx/fs/fs.h> #include <nuttx/arch.h> #include <nuttx/pwm.h> @@ -587,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 *)zalloc(sizeof(struct pwm_upperhalf_s)); + upper = (FAR struct pwm_upperhalf_s *)kzalloc(sizeof(struct pwm_upperhalf_s)); if (!upper) { pwmdbg("Allocation failed\n"); return -ENOMEM; } - /* Initialize the PWM device structure (it was already zeroed by zalloc()) */ + /* Initialize the PWM device structure (it was already zeroed by kzalloc()) */ sem_init(&upper->exclsem, 0, 1); #ifdef CONFIG_PWM_PULSECOUNT diff --git a/nuttx/drivers/sensors/lm75.c b/nuttx/drivers/sensors/lm75.c index 2d3346447..2884f29c6 100644 --- a/nuttx/drivers/sensors/lm75.c +++ b/nuttx/drivers/sensors/lm75.c @@ -2,7 +2,7 @@ * drivers/sensors/lm75.c * Character driver for the STMicro LM-75 Temperature Sensor * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,7 @@ #include <errno.h> #include <debug.h> +#include <nuttx/kmalloc.h> #include <nuttx/fs/fs.h> #include <nuttx/i2c.h> #include <nuttx/sensors/lm75.h> @@ -513,7 +514,7 @@ int lm75_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c, uint8_t ad /* Initialize the LM-75 device structure */ - priv = (FAR struct lm75_dev_s *)malloc(sizeof(struct lm75_dev_s)); + priv = (FAR struct lm75_dev_s *)kmalloc(sizeof(struct lm75_dev_s)); if (!priv) { lm75dbg("Failed to allocate instance\n"); @@ -530,8 +531,9 @@ int lm75_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c, uint8_t ad if (ret < 0) { lm75dbg("Failed to register driver: %d\n", ret); - free(priv); + kfree(priv); } + return ret; } #endif /* CONFIG_I2C && CONFIG_I2C_LM75 */ diff --git a/nuttx/drivers/sensors/qencoder.c b/nuttx/drivers/sensors/qencoder.c index a56adec9a..d9f3d7625 100644 --- a/nuttx/drivers/sensors/qencoder.c +++ b/nuttx/drivers/sensors/qencoder.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/sensors/qencoder.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,7 @@ #include <errno.h> #include <debug.h> +#include <nuttx/kmalloc.h> #include <nuttx/fs/fs.h> #include <nuttx/arch.h> #include <nuttx/sensors/qencoder.h> @@ -381,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 *)zalloc(sizeof(struct qe_upperhalf_s)); + upper = (FAR struct qe_upperhalf_s *)kzalloc(sizeof(struct qe_upperhalf_s)); if (!upper) { qedbg("Allocation failed\n"); return -ENOMEM; } - /* Initialize the PWM device structure (it was already zeroed by zalloc()) */ + /* Initialize the PWM device structure (it was already zeroed by kzalloc()) */ sem_init(&upper->exclsem, 0, 1); upper->lower = lower; diff --git a/nuttx/drivers/usbdev/usbmsc.c b/nuttx/drivers/usbdev/usbmsc.c index 68b61814a..8dafbae5d 100644 --- a/nuttx/drivers/usbdev/usbmsc.c +++ b/nuttx/drivers/usbdev/usbmsc.c @@ -1472,7 +1472,7 @@ int usbmsc_bindlun(FAR void *handle, FAR const char *drvrpath, else if (priv->iosize < geo.geo_sectorsize) { void *tmp; - tmp = (uint8_t*)realloc(priv->iobuffer, geo.geo_sectorsize); + tmp = (uint8_t*)krealloc(priv->iobuffer, geo.geo_sectorsize); if (!tmp) { usbtrace(TRACE_CLSERROR(USBMSC_TRACEERR_REALLOCIOBUFFER), geo.geo_sectorsize); |