9
0
Fork 0

Rename kfree to kmm_free for consistency with other naming conventions

This commit is contained in:
Gregory Nutt 2014-08-31 17:04:02 -06:00
parent 2ad3a4c2a2
commit 7482b7ad0f
137 changed files with 646 additions and 641 deletions

View File

@ -410,7 +410,7 @@ FAR char *exepath_next(EXEPATH_HANDLE handle, FAR const char *relpath);
</p> </p>
<p> <p>
NOTE: The string pointer return in the success case points to allocated memory. NOTE: The string pointer return in the success case points to allocated memory.
This memory must be freed by the called by calling <code>kfree()</code>. This memory must be freed by the called by calling <code>kmm_free()</code>.
</p> </p>
<p> <p>
<code>NULL</code is returned if no path is found to any file with the provided <code>relpath</colde> from any absolute path in the <code>PATH</code> variable. <code>NULL</code is returned if no path is found to any file with the provided <code>relpath</colde> from any absolute path in the <code>PATH</code> variable.

View File

@ -726,7 +726,7 @@ static void dm320_freevideomemory(void)
#ifndef CONFIG_DM320_VID0_DISABLE #ifndef CONFIG_DM320_VID0_DISABLE
if (g_vid0base) if (g_vid0base)
{ {
kfree(g_vid0base); kmm_free(g_vid0base);
g_vid0base = NULL; g_vid0base = NULL;
#ifndef CONFIG_DM320_DISABLE_PINGPONG #ifndef CONFIG_DM320_DISABLE_PINGPONG
g_vid0ppbase = NULL; g_vid0ppbase = NULL;
@ -737,7 +737,7 @@ static void dm320_freevideomemory(void)
#ifndef CONFIG_DM320_VID1_DISABLE #ifndef CONFIG_DM320_VID1_DISABLE
if (g_vid1base != 0) if (g_vid1base != 0)
{ {
kfree(g_vid1base); kmm_free(g_vid1base);
g_vid1base = NULL; g_vid1base = NULL;
} }
#endif #endif
@ -745,7 +745,7 @@ static void dm320_freevideomemory(void)
#ifndef CONFIG_DM320_OSD0_DISABLE #ifndef CONFIG_DM320_OSD0_DISABLE
if (g_osd0base != 0) if (g_osd0base != 0)
{ {
kfree(g_osd0base); kmm_free(g_osd0base);
g_osd0base = NULL; g_osd0base = NULL;
} }
#endif #endif
@ -753,7 +753,7 @@ static void dm320_freevideomemory(void)
#ifndef CONFIG_DM320_OSD1_DISABLE #ifndef CONFIG_DM320_OSD1_DISABLE
if (g_osd1base != 0) if (g_osd1base != 0)
{ {
kfree(g_osd1base); kmm_free(g_osd1base);
g_osd1base = NULL; g_osd1base = NULL;
} }
#endif #endif

View File

@ -1969,7 +1969,7 @@ static void dm320_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
#endif #endif
usbtrace(TRACE_EPFREEREQ, ((FAR struct dm320_ep_s *)ep)->epphy); usbtrace(TRACE_EPFREEREQ, ((FAR struct dm320_ep_s *)ep)->epphy);
kfree(privreq); kmm_free(privreq);
} }
/******************************************************************************* /*******************************************************************************
@ -2009,7 +2009,7 @@ static void dm320_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
#ifdef CONFIG_USBDEV_DMAMEMORY #ifdef CONFIG_USBDEV_DMAMEMORY
usbdev_dma_free(buf); usbdev_dma_free(buf);
#else #else
kfree(buf); kmm_free(buf);
#endif #endif
} }
#endif #endif

View File

@ -2691,7 +2691,7 @@ static void lpc17_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
#endif #endif
usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc17_ep_s *)ep)->epphy); usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc17_ep_s *)ep)->epphy);
kfree(privreq); kmm_free(privreq);
} }
/******************************************************************************* /*******************************************************************************
@ -2768,7 +2768,7 @@ static void lpc17_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
#else #else
usbtrace(TRACE_EPFREEBUFFER, privep->epphy); usbtrace(TRACE_EPFREEBUFFER, privep->epphy);
kfree(buf); kmm_free(buf);
#endif #endif
} }

View File

@ -2003,7 +2003,7 @@ static int lpc17_alloc(FAR struct usbhost_driver_s *drvr,
* Some hardware supports special memory in which request and descriptor data can * Some hardware supports special memory in which request and descriptor data can
* be accessed more efficiently. This method provides a mechanism to free that * be accessed more efficiently. This method provides a mechanism to free that
* request/descriptor memory. If the underlying hardware does not support * request/descriptor memory. If the underlying hardware does not support
* such "special" memory, this functions may simply map to kfree(). * such "special" memory, this functions may simply map to kmm_free().
* *
* Input Parameters: * Input Parameters:
* drvr - The USB host driver instance obtained as a parameter from the call to * drvr - The USB host driver instance obtained as a parameter from the call to
@ -2087,7 +2087,7 @@ static int lpc17_ioalloc(FAR struct usbhost_driver_s *drvr,
* Some hardware supports special memory in which IO data can be accessed more * Some hardware supports special memory in which IO data can be accessed more
* efficiently. This method provides a mechanism to free that IO buffer * efficiently. This method provides a mechanism to free that IO buffer
* memory. If the underlying hardware does not support such "special" memory, * memory. If the underlying hardware does not support such "special" memory,
* this functions may simply map to kfree(). * this functions may simply map to kmm_free().
* *
* Input Parameters: * Input Parameters:
* drvr - The USB host driver instance obtained as a parameter from the call to * drvr - The USB host driver instance obtained as a parameter from the call to

View File

@ -2655,7 +2655,7 @@ static void lpc214x_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_
#endif #endif
usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc214x_ep_s *)ep)->epphy); usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc214x_ep_s *)ep)->epphy);
kfree(privreq); kmm_free(privreq);
} }
/******************************************************************************* /*******************************************************************************
@ -2732,7 +2732,7 @@ static void lpc214x_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
#else #else
usbtrace(TRACE_EPFREEBUFFER, privep->epphy); usbtrace(TRACE_EPFREEBUFFER, privep->epphy);
kfree(buf); kmm_free(buf);
#endif #endif
} }

View File

@ -3679,7 +3679,7 @@ static int lpc31_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep)
/* Free the container */ /* Free the container */
kfree(epinfo); kmm_free(epinfo);
return OK; return OK;
} }
@ -3740,7 +3740,7 @@ static int lpc31_alloc(FAR struct usbhost_driver_s *drvr,
* Some hardware supports special memory in which request and descriptor data * Some hardware supports special memory in which request and descriptor data
* can be accessed more efficiently. This method provides a mechanism to * can be accessed more efficiently. This method provides a mechanism to
* free that request/descriptor memory. If the underlying hardware does not * free that request/descriptor memory. If the underlying hardware does not
* support such "special" memory, this functions may simply map to kfree(). * support such "special" memory, this functions may simply map to kmm_free().
* *
* Input Parameters: * Input Parameters:
* drvr - The USB host driver instance obtained as a parameter from the call * drvr - The USB host driver instance obtained as a parameter from the call
@ -3762,7 +3762,7 @@ static int lpc31_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer)
/* No special action is require to free the transfer/descriptor buffer memory */ /* No special action is require to free the transfer/descriptor buffer memory */
kfree(buffer); kmm_free(buffer);
return OK; return OK;
} }
@ -4279,7 +4279,7 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller)
if (!g_qtdpool) if (!g_qtdpool)
{ {
usbhost_trace1(EHCI_TRACE1_QTDPOOLALLOC_FAILED, 0); usbhost_trace1(EHCI_TRACE1_QTDPOOLALLOC_FAILED, 0);
kfree(g_qhpool); kmm_free(g_qhpool);
return NULL; return NULL;
} }
#endif #endif
@ -4292,8 +4292,8 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller)
if (!g_framelist) if (!g_framelist)
{ {
usbhost_trace1(EHCI_TRACE1_PERFLALLOC_FAILED, 0); usbhost_trace1(EHCI_TRACE1_PERFLALLOC_FAILED, 0);
kfree(g_qhpool); kmm_free(g_qhpool);
kfree(g_qtdpool); kmm_free(g_qtdpool);
return NULL; return NULL;
} }
#endif #endif

View File

@ -1982,7 +1982,7 @@ static void lpc31_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
#endif #endif
usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc31_ep_s *)ep)->epphy); usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc31_ep_s *)ep)->epphy);
kfree(privreq); kmm_free(privreq);
} }
/******************************************************************************* /*******************************************************************************
@ -2022,7 +2022,7 @@ static void lpc31_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
#ifdef CONFIG_USBDEV_DMAMEMORY #ifdef CONFIG_USBDEV_DMAMEMORY
usbdev_dma_free(buf); usbdev_dma_free(buf);
#else #else
kfree(buf); kmm_free(buf);
#endif #endif
} }
#endif #endif

View File

@ -1982,7 +1982,7 @@ static void lpc43_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
#endif #endif
usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc43_ep_s *)ep)->epphy); usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc43_ep_s *)ep)->epphy);
kfree(privreq); kmm_free(privreq);
} }
/******************************************************************************* /*******************************************************************************
@ -2022,7 +2022,7 @@ static void lpc43_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
#ifdef CONFIG_USBDEV_DMAMEMORY #ifdef CONFIG_USBDEV_DMAMEMORY
usbdev_dma_free(buf); usbdev_dma_free(buf);
#else #else
kfree(buf); kmm_free(buf);
#endif #endif
} }
#endif #endif

View File

@ -657,25 +657,25 @@ static void sam_buffer_free(struct sam_emac_s *priv)
if (priv->txdesc) if (priv->txdesc)
{ {
kfree(priv->txdesc); kmm_free(priv->txdesc);
priv->txdesc = NULL; priv->txdesc = NULL;
} }
if (priv->rxdesc) if (priv->rxdesc)
{ {
kfree(priv->rxdesc); kmm_free(priv->rxdesc);
priv->rxdesc = NULL; priv->rxdesc = NULL;
} }
if (priv->txbuffer) if (priv->txbuffer)
{ {
kfree(priv->txbuffer); kmm_free(priv->txbuffer);
priv->txbuffer = NULL; priv->txbuffer = NULL;
} }
if (priv->rxbuffer) if (priv->rxbuffer)
{ {
kfree(priv->rxbuffer); kmm_free(priv->rxbuffer);
priv->rxbuffer = NULL; priv->rxbuffer = NULL;
} }
#endif #endif

View File

@ -3019,7 +3019,7 @@ static void sam_ep_freereq(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
#endif #endif
usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog)); usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog));
kfree(privreq); kmm_free(privreq);
} }
/**************************************************************************** /****************************************************************************

View File

@ -3519,7 +3519,7 @@ static int sam_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep)
/* Free the container */ /* Free the container */
kfree(epinfo); kmm_free(epinfo);
return OK; return OK;
} }
@ -3580,7 +3580,7 @@ static int sam_alloc(FAR struct usbhost_driver_s *drvr,
* Some hardware supports special memory in which request and descriptor data * Some hardware supports special memory in which request and descriptor data
* can be accessed more efficiently. This method provides a mechanism to * can be accessed more efficiently. This method provides a mechanism to
* free that request/descriptor memory. If the underlying hardware does not * free that request/descriptor memory. If the underlying hardware does not
* support such "special" memory, this functions may simply map to kfree(). * support such "special" memory, this functions may simply map to kmm_free().
* *
* Input Parameters: * Input Parameters:
* drvr - The USB host driver instance obtained as a parameter from the call * drvr - The USB host driver instance obtained as a parameter from the call
@ -3602,7 +3602,7 @@ static int sam_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer)
/* No special action is require to free the transfer/descriptor buffer memory */ /* No special action is require to free the transfer/descriptor buffer memory */
kfree(buffer); kmm_free(buffer);
return OK; return OK;
} }
@ -4177,7 +4177,7 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller)
if (!g_qtdpool) if (!g_qtdpool)
{ {
usbhost_trace1(EHCI_TRACE1_QTDPOOLALLOC_FAILED, 0); usbhost_trace1(EHCI_TRACE1_QTDPOOLALLOC_FAILED, 0);
kfree(g_qhpool); kmm_free(g_qhpool);
return NULL; return NULL;
} }
#endif #endif
@ -4190,8 +4190,8 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller)
if (!g_framelist) if (!g_framelist)
{ {
usbhost_trace1(EHCI_TRACE1_PERFLALLOC_FAILED, 0); usbhost_trace1(EHCI_TRACE1_PERFLALLOC_FAILED, 0);
kfree(g_qhpool); kmm_free(g_qhpool);
kfree(g_qtdpool); kmm_free(g_qtdpool);
return NULL; return NULL;
} }
#endif #endif

View File

@ -662,25 +662,25 @@ static void sam_buffer_free(struct sam_emac_s *priv)
if (priv->txdesc) if (priv->txdesc)
{ {
kfree(priv->txdesc); kmm_free(priv->txdesc);
priv->txdesc = NULL; priv->txdesc = NULL;
} }
if (priv->rxdesc) if (priv->rxdesc)
{ {
kfree(priv->rxdesc); kmm_free(priv->rxdesc);
priv->rxdesc = NULL; priv->rxdesc = NULL;
} }
if (priv->txbuffer) if (priv->txbuffer)
{ {
kfree(priv->txbuffer); kmm_free(priv->txbuffer);
priv->txbuffer = NULL; priv->txbuffer = NULL;
} }
if (priv->rxbuffer) if (priv->rxbuffer)
{ {
kfree(priv->rxbuffer); kmm_free(priv->rxbuffer);
priv->rxbuffer = NULL; priv->rxbuffer = NULL;
} }
#endif #endif

View File

@ -989,25 +989,25 @@ static void sam_buffer_free(struct sam_emac_s *priv)
if (priv->txdesc) if (priv->txdesc)
{ {
kfree(priv->txdesc); kmm_free(priv->txdesc);
priv->txdesc = NULL; priv->txdesc = NULL;
} }
if (priv->rxdesc) if (priv->rxdesc)
{ {
kfree(priv->rxdesc); kmm_free(priv->rxdesc);
priv->rxdesc = NULL; priv->rxdesc = NULL;
} }
if (priv->txbuffer) if (priv->txbuffer)
{ {
kfree(priv->txbuffer); kmm_free(priv->txbuffer);
priv->txbuffer = NULL; priv->txbuffer = NULL;
} }
if (priv->rxbuffer) if (priv->rxbuffer)
{ {
kfree(priv->rxbuffer); kmm_free(priv->rxbuffer);
priv->rxbuffer = NULL; priv->rxbuffer = NULL;
} }
#endif #endif

View File

@ -593,25 +593,25 @@ static void sam_buffer_free(struct sam_gmac_s *priv)
if (priv->txdesc) if (priv->txdesc)
{ {
kfree(priv->txdesc); kmm_free(priv->txdesc);
priv->txdesc = NULL; priv->txdesc = NULL;
} }
if (priv->rxdesc) if (priv->rxdesc)
{ {
kfree(priv->rxdesc); kmm_free(priv->rxdesc);
priv->rxdesc = NULL; priv->rxdesc = NULL;
} }
if (priv->txbuffer) if (priv->txbuffer)
{ {
kfree(priv->txbuffer); kmm_free(priv->txbuffer);
priv->txbuffer = NULL; priv->txbuffer = NULL;
} }
if (priv->rxbuffer) if (priv->rxbuffer)
{ {
kfree(priv->rxbuffer); kmm_free(priv->rxbuffer);
priv->rxbuffer = NULL; priv->rxbuffer = NULL;
} }
#endif #endif

View File

@ -2500,7 +2500,7 @@ errout_with_ed:
sam_edfree(ed); sam_edfree(ed);
errout_with_semaphore: errout_with_semaphore:
sam_givesem(&g_ohci.exclsem); sam_givesem(&g_ohci.exclsem);
kfree(eplist); kmm_free(eplist);
errout: errout:
return ret; return ret;
} }
@ -2577,7 +2577,7 @@ static int sam_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep)
/* And free the container */ /* And free the container */
sem_destroy(&eplist->wdhsem); sem_destroy(&eplist->wdhsem);
kfree(eplist); kmm_free(eplist);
sam_givesem(&g_ohci.exclsem); sam_givesem(&g_ohci.exclsem);
return ret; return ret;
} }
@ -2642,7 +2642,7 @@ static int sam_alloc(FAR struct usbhost_driver_s *drvr,
* Some hardware supports special memory in which request and descriptor data * Some hardware supports special memory in which request and descriptor data
* can be accessed more efficiently. This method provides a mechanism to * can be accessed more efficiently. This method provides a mechanism to
* free that request/descriptor memory. If the underlying hardware does not * free that request/descriptor memory. If the underlying hardware does not
* support such "special" memory, this functions may simply map to kfree(). * support such "special" memory, this functions may simply map to kmm_free().
* *
* Input Parameters: * Input Parameters:
* drvr - The USB host driver instance obtained as a parameter from the call * drvr - The USB host driver instance obtained as a parameter from the call

View File

@ -3524,7 +3524,7 @@ errout_with_clocking:
errout_with_alloc: errout_with_alloc:
sem_destroy(&priv->exclsem); sem_destroy(&priv->exclsem);
kfree(priv); kmm_free(priv);
return NULL; return NULL;
} }

View File

@ -3508,7 +3508,7 @@ static void sam_ep_freereq(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
#endif #endif
usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog)); usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog));
kfree(privreq); kmm_free(privreq);
} }
/**************************************************************************** /****************************************************************************

View File

@ -1977,7 +1977,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev)
if (--((struct stm32_i2c_inst_s *)dev)->priv->refs) if (--((struct stm32_i2c_inst_s *)dev)->priv->refs)
{ {
irqrestore(irqs); irqrestore(irqs);
kfree(dev); kmm_free(dev);
return OK; return OK;
} }
@ -1991,7 +1991,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev)
stm32_i2c_sem_destroy((struct i2c_dev_s *)dev); stm32_i2c_sem_destroy((struct i2c_dev_s *)dev);
kfree(dev); kmm_free(dev);
return OK; return OK;
} }

View File

@ -2505,7 +2505,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev)
if (--((struct stm32_i2c_inst_s *)dev)->priv->refs) if (--((struct stm32_i2c_inst_s *)dev)->priv->refs)
{ {
irqrestore(irqs); irqrestore(irqs);
kfree(dev); kmm_free(dev);
return OK; return OK;
} }
@ -2519,7 +2519,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev)
stm32_i2c_sem_destroy((struct i2c_dev_s *)dev); stm32_i2c_sem_destroy((struct i2c_dev_s *)dev);
kfree(dev); kmm_free(dev);
return OK; return OK;
} }

View File

@ -4269,7 +4269,7 @@ static void stm32_ep_freereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
#endif #endif
usbtrace(TRACE_EPFREEREQ, ((FAR struct stm32_ep_s *)ep)->epphy); usbtrace(TRACE_EPFREEREQ, ((FAR struct stm32_ep_s *)ep)->epphy);
kfree(privreq); kmm_free(privreq);
} }
/******************************************************************************* /*******************************************************************************
@ -4309,7 +4309,7 @@ static void stm32_ep_freebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
#ifdef CONFIG_USBDEV_DMAMEMORY #ifdef CONFIG_USBDEV_DMAMEMORY
usbdev_dma_free(buf); usbdev_dma_free(buf);
#else #else
kfree(buf); kmm_free(buf);
#endif #endif
} }
#endif #endif

View File

@ -3534,7 +3534,7 @@ static int stm32_alloc(FAR struct usbhost_driver_s *drvr,
* Some hardware supports special memory in which request and descriptor data can * Some hardware supports special memory in which request and descriptor data can
* be accessed more efficiently. This method provides a mechanism to free that * be accessed more efficiently. This method provides a mechanism to free that
* request/descriptor memory. If the underlying hardware does not support * request/descriptor memory. If the underlying hardware does not support
* such "special" memory, this functions may simply map to kfree(). * such "special" memory, this functions may simply map to kmm_free().
* *
* Input Parameters: * Input Parameters:
* drvr - The USB host driver instance obtained as a parameter from the call to * drvr - The USB host driver instance obtained as a parameter from the call to
@ -3555,7 +3555,7 @@ static int stm32_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer)
/* There is no special memory requirement */ /* There is no special memory requirement */
DEBUGASSERT(drvr && buffer); DEBUGASSERT(drvr && buffer);
kfree(buffer); kmm_free(buffer);
return OK; return OK;
} }
@ -3614,7 +3614,7 @@ static int stm32_ioalloc(FAR struct usbhost_driver_s *drvr,
* Some hardware supports special memory in which IO data can be accessed more * Some hardware supports special memory in which IO data can be accessed more
* efficiently. This method provides a mechanism to free that IO buffer * efficiently. This method provides a mechanism to free that IO buffer
* memory. If the underlying hardware does not support such "special" memory, * memory. If the underlying hardware does not support such "special" memory,
* this functions may simply map to kfree(). * this functions may simply map to kmm_free().
* *
* Input Parameters: * Input Parameters:
* drvr - The USB host driver instance obtained as a parameter from the call to * drvr - The USB host driver instance obtained as a parameter from the call to
@ -3635,7 +3635,7 @@ static int stm32_iofree(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer)
/* There is no special memory requirement */ /* There is no special memory requirement */
DEBUGASSERT(drvr && buffer); DEBUGASSERT(drvr && buffer);
kfree(buffer); kmm_free(buffer);
return OK; return OK;
} }

View File

@ -193,7 +193,7 @@ static int ccm_close(FAR struct file *filep)
/* Release the file attributes structure */ /* Release the file attributes structure */
kfree(priv); kmm_free(priv);
filep->f_priv = NULL; filep->f_priv = NULL;
return OK; return OK;
} }

View File

@ -3005,7 +3005,7 @@ static void stm32_epfreereq(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
#endif #endif
usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog)); usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog));
kfree(privreq); kmm_free(privreq);
} }
/**************************************************************************** /****************************************************************************

View File

@ -2068,7 +2068,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev)
if (--((struct stm32_i2c_inst_s *)dev)->priv->refs) if (--((struct stm32_i2c_inst_s *)dev)->priv->refs)
{ {
irqrestore(irqs); irqrestore(irqs);
kfree(dev); kmm_free(dev);
return OK; return OK;
} }
@ -2082,7 +2082,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev)
stm32_i2c_sem_destroy( (struct i2c_dev_s *)dev ); stm32_i2c_sem_destroy( (struct i2c_dev_s *)dev );
kfree(dev); kmm_free(dev);
return OK; return OK;
} }

View File

@ -2320,7 +2320,7 @@ static void avr_epfreereq(FAR struct usbdev_ep_s *ep,
#endif #endif
usbtrace(TRACE_EPFREEREQ, ((FAR struct avr_ep_s *)ep)->ep.eplog); usbtrace(TRACE_EPFREEREQ, ((FAR struct avr_ep_s *)ep)->ep.eplog);
kfree(privreq); kmm_free(privreq);
} }
/******************************************************************************* /*******************************************************************************
@ -2360,7 +2360,7 @@ static void avr_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
#ifdef CONFIG_USBDEV_DMAMEMORY #ifdef CONFIG_USBDEV_DMAMEMORY
usbdev_dma_free(buf); usbdev_dma_free(buf);
#else #else
kfree(buf); kmm_free(buf);
#endif #endif
} }
#endif #endif

View File

@ -3352,7 +3352,7 @@ static void pic32mx_epfreereq(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
#endif #endif
usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog)); usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog));
kfree(privreq); kmm_free(privreq);
} }
/**************************************************************************** /****************************************************************************

View File

@ -125,7 +125,7 @@ int rtos_bridge_init(struct rgmp_bridge *b)
return 0; return 0;
err1: err1:
kfree(bridge); kmm_free(bridge);
err0: err0:
return -1; return -1;
} }

View File

@ -210,7 +210,7 @@ void up_release_stack(struct tcb_s *dtcb, uint8_t ttype)
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) { if (ttype == TCB_FLAG_TTYPE_KERNEL) {
kfree(dtcb->stack_alloc_ptr); kmm_free(dtcb->stack_alloc_ptr);
} else } else
#endif #endif
{ {

View File

@ -85,7 +85,7 @@ void *rtos_kmalloc(int size)
void rtos_kfree(void *addr) void rtos_kfree(void *addr)
{ {
kfree(addr); kmm_free(addr);
} }
/** /**

View File

@ -202,7 +202,7 @@ static uart_dev_t *up_alloc_com(unsigned int base, int irq)
return dev; return dev;
err1: err1:
kfree(priv); kmm_free(priv);
err0: err0:
return NULL; return NULL;
} }
@ -213,8 +213,8 @@ static uart_dev_t *up_alloc_com(unsigned int base, int irq)
static inline void up_free_com(uart_dev_t *com) static inline void up_free_com(uart_dev_t *com)
{ {
kfree(com->priv); kmm_free(com->priv);
kfree(com); kmm_free(com);
} }
/**************************************************************************** /****************************************************************************

View File

@ -59,8 +59,8 @@
#ifdef VFAT_STANDALONE #ifdef VFAT_STANDALONE
# define sdbg(format, ...) printf(format, ##__VA_ARGS__) # define sdbg(format, ...) printf(format, ##__VA_ARGS__)
# define kmalloc(size) malloc(size) # define kmm_malloc(size) malloc(size)
# define kfree(mem) free(mem) # define kmm_free(mem) free(mem)
#endif #endif
/**************************************************************************** /****************************************************************************
@ -231,7 +231,7 @@ char *up_deviceimage(void)
* to reallocate this a few times to get the size right. * to reallocate this a few times to get the size right.
*/ */
pbuffer = (char*)kmalloc(bufsize); pbuffer = (char*)kmm_malloc(bufsize);
/* Set up the input buffer */ /* Set up the input buffer */
@ -260,7 +260,7 @@ char *up_deviceimage(void)
case Z_STREAM_ERROR: case Z_STREAM_ERROR:
sdbg("inflate FAILED: ret=%d msg=\"%s\"\n", ret, strm.msg ? strm.msg : "No message" ); sdbg("inflate FAILED: ret=%d msg=\"%s\"\n", ret, strm.msg ? strm.msg : "No message" );
(void)inflateEnd(&strm); (void)inflateEnd(&strm);
kfree(pbuffer); kmm_free(pbuffer);
return NULL; return NULL;
} }
@ -275,7 +275,7 @@ char *up_deviceimage(void)
char *newbuffer = kmm_realloc(pbuffer, newbufsize); char *newbuffer = kmm_realloc(pbuffer, newbufsize);
if (!newbuffer) if (!newbuffer)
{ {
kfree(pbuffer); kmm_free(pbuffer);
return NULL; return NULL;
} }
else else
@ -295,7 +295,7 @@ char *up_deviceimage(void)
char *newbuffer = kmm_realloc(pbuffer, newbufsize); char *newbuffer = kmm_realloc(pbuffer, newbufsize);
if (!newbuffer) if (!newbuffer)
{ {
kfree(pbuffer); kmm_free(pbuffer);
return NULL; return NULL;
} }
else else
@ -351,7 +351,7 @@ int main(int argc, char **argv, char **envp)
if (deviceimage) if (deviceimage)
{ {
printf("Inflate SUCCEEDED\n"); printf("Inflate SUCCEEDED\n");
kfree(deviceimage); kmm_free(deviceimage);
return 0; return 0;
} }
else else

View File

@ -124,7 +124,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
if (ret < 0) if (ret < 0)
{ {
bdbg("ERROR: Failed to load program '%s'\n", filename); bdbg("ERROR: Failed to load program '%s'\n", filename);
kfree(bin); kmm_free(bin);
return ERROR; return ERROR;
} }
@ -143,7 +143,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
bdbg("ERROR: Failed to execute program '%s'\n", filename); bdbg("ERROR: Failed to execute program '%s'\n", filename);
sched_unlock(); sched_unlock();
unload_module(bin); unload_module(bin);
kfree(bin); kmm_free(bin);
return ERROR; return ERROR;
} }

View File

@ -257,7 +257,7 @@ errout_with_stack:
goto errout; goto errout;
errout_with_tcb: errout_with_tcb:
kfree(tcb); kmm_free(tcb);
errout: errout:
set_errno(err); set_errno(err);
bdbg("returning errno: %d\n", err); bdbg("returning errno: %d\n", err);

View File

@ -161,7 +161,7 @@ EXEPATH_HANDLE exepath_init(void)
* is marked executable). * is marked executable).
* *
* NOTE: The string pointer return in the success case points to allocated * NOTE: The string pointer return in the success case points to allocated
* memory. This memory must be freed by the called by calling kfree(). * memory. This memory must be freed by the called by calling kmm_free().
* *
* NULL is returned if no path is found to any file with the provided * NULL is returned if no path is found to any file with the provided
* 'relpath' from any absolute path in the PATH variable. In this case, * 'relpath' from any absolute path in the PATH variable. In this case,
@ -254,7 +254,7 @@ FAR char *exepath_next(EXEPATH_HANDLE handle, FAR const char *relpath)
* continue to try the next path. * continue to try the next path.
*/ */
kfree(fullpath); kmm_free(fullpath);
} }
/* We will not get here */ /* We will not get here */
@ -279,7 +279,7 @@ FAR char *exepath_next(EXEPATH_HANDLE handle, FAR const char *relpath)
void exepath_release(EXEPATH_HANDLE handle) void exepath_release(EXEPATH_HANDLE handle)
{ {
kfree(handle); kmm_free(handle);
} }
#endif /* !CONFIG_BINFMT_DISABLE && CONFIG_BINFMT_EXEPATH */ #endif /* !CONFIG_BINFMT_DISABLE && CONFIG_BINFMT_EXEPATH */

View File

@ -226,7 +226,7 @@ int load_module(FAR struct binary_s *bin)
/* Free the allocated fullpath */ /* Free the allocated fullpath */
kfree(fullpath); kmm_free(fullpath);
/* Break out of the loop with ret == OK on success */ /* Break out of the loop with ret == OK on success */

View File

@ -188,7 +188,7 @@ static FAR struct binary_s *unload_list_remove(pid_t pid)
* If CONFIG_SCHED_HAVE_PARENT is defined, this function may be called to * If CONFIG_SCHED_HAVE_PARENT is defined, this function may be called to
* automatically unload the module when task exits. It assumes that * automatically unload the module when task exits. It assumes that
* bin was allocated with kmalloc() or friends and will also automatically * bin was allocated with kmalloc() or friends and will also automatically
* free the structure with kfree() when the task exists. * free the structure with kmm_free() when the task exists.
* *
* Input Parameter: * Input Parameter:
* pid - The ID of the task that just exited * pid - The ID of the task that just exited
@ -231,7 +231,7 @@ static void unload_callback(int signo, siginfo_t *info, void *ucontext)
/* Free the load structure */ /* Free the load structure */
kfree(bin); kmm_free(bin);
} }
/**************************************************************************** /****************************************************************************
@ -246,7 +246,7 @@ static void unload_callback(int signo, siginfo_t *info, void *ucontext)
* the parent of the newly created task to automatically unload the * the parent of the newly created task to automatically unload the
* module when the task exits. This assumes that (1) the caller is the * module when the task exits. This assumes that (1) the caller is the
* parent of the created task, (2) that bin was allocated with kmalloc() * parent of the created task, (2) that bin was allocated with kmalloc()
* or friends. It will also automatically free the structure with kfree() * or friends. It will also automatically free the structure with kmm_free()
* after unloading the module. * after unloading the module.
* *
* Input Parameter: * Input Parameter:

View File

@ -111,13 +111,13 @@ int elf_freebuffers(struct elf_loadinfo_s *loadinfo)
if (loadinfo->shdr) if (loadinfo->shdr)
{ {
kfree((FAR void *)loadinfo->shdr); kmm_free((FAR void *)loadinfo->shdr);
loadinfo->shdr = NULL; loadinfo->shdr = NULL;
} }
if (loadinfo->iobuffer) if (loadinfo->iobuffer)
{ {
kfree((FAR void *)loadinfo->iobuffer); kmm_free((FAR void *)loadinfo->iobuffer);
loadinfo->iobuffer = NULL; loadinfo->iobuffer = NULL;
loadinfo->buflen = 0; loadinfo->buflen = 0;
} }

View File

@ -157,7 +157,7 @@ errout_with_addrenv:
loadinfo->addrenv = 0; loadinfo->addrenv = 0;
errout_with_dspace: errout_with_dspace:
kfree(dspace); kmm_free(dspace);
return ret; return ret;
#else #else
/* Allocate (and zero) memory to hold the ELF image */ /* Allocate (and zero) memory to hold the ELF image */
@ -165,7 +165,7 @@ errout_with_dspace:
dspace->region = (FAR uint8_t *)kumm_zalloc(envsize); dspace->region = (FAR uint8_t *)kumm_zalloc(envsize);
if (!dspace->region) if (!dspace->region)
{ {
kfree(dspace); kmm_free(dspace);
return -ENOMEM; return -ENOMEM;
} }
@ -227,7 +227,7 @@ void nxflat_addrenv_free(FAR struct nxflat_loadinfo_s *loadinfo)
/* Now destroy the D-Space container */ /* Now destroy the D-Space container */
DEBUGASSERT(dspace->crefs == 1); DEBUGASSERT(dspace->crefs == 1);
kfree(dspace); kmm_free(dspace);
loadinfo->dspace = NULL; loadinfo->dspace = NULL;
} }
} }

View File

@ -267,7 +267,7 @@ static int pcode_proxy(int argc, char **argv)
if (ret < 0) if (ret < 0)
{ {
bdbg("ERROR: on_exit failed: %d\n", get_errno()); bdbg("ERROR: on_exit failed: %d\n", get_errno());
kfree(fullpath); kmm_free(fullpath);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -277,7 +277,7 @@ static int pcode_proxy(int argc, char **argv)
/* We no longer need the fullpath */ /* We no longer need the fullpath */
kfree(fullpath); kmm_free(fullpath);
/* Check the result of the interpretation */ /* Check the result of the interpretation */

View File

@ -108,7 +108,7 @@ int usbmsc_archinitialize(void)
{ {
printf("create_ramdisk: Failed to register ramdisk at %s: %d\n", printf("create_ramdisk: Failed to register ramdisk at %s: %d\n",
g_source, -ret); g_source, -ret);
kfree(pbuffer); kmm_free(pbuffer);
return ret; return ret;
} }
@ -119,7 +119,7 @@ int usbmsc_archinitialize(void)
{ {
printf("create_ramdisk: Failed to create FAT filesystem on ramdisk at %s\n", printf("create_ramdisk: Failed to create FAT filesystem on ramdisk at %s\n",
g_source); g_source);
/* kfree(pbuffer); -- RAM disk is registered */ /* kmm_free(pbuffer); -- RAM disk is registered */
return ret; return ret;
} }

View File

@ -108,7 +108,7 @@ int usbmsc_archinitialize(void)
{ {
printf("create_ramdisk: Failed to register ramdisk at %s: %d\n", printf("create_ramdisk: Failed to register ramdisk at %s: %d\n",
g_source, -ret); g_source, -ret);
kfree(pbuffer); kmm_free(pbuffer);
return ret; return ret;
} }
@ -119,7 +119,7 @@ int usbmsc_archinitialize(void)
{ {
printf("create_ramdisk: Failed to create FAT filesystem on ramdisk at %s\n", printf("create_ramdisk: Failed to create FAT filesystem on ramdisk at %s\n",
g_source); g_source);
/* kfree(pbuffer); -- RAM disk is registered */ /* kmm_free(pbuffer); -- RAM disk is registered */
return ret; return ret;
} }

View File

@ -1578,7 +1578,7 @@ int arch_tcinitialize(int minor)
errout_with_priv: errout_with_priv:
sem_destroy(&priv->devsem); sem_destroy(&priv->devsem);
#ifdef CONFIG_TOUCHSCREEN_MULTIPLE #ifdef CONFIG_TOUCHSCREEN_MULTIPLE
kfree(priv); kmm_free(priv);
#endif #endif
return ret; return ret;
} }

View File

@ -1431,7 +1431,7 @@ int arch_tcinitialize(int minor)
errout_with_priv: errout_with_priv:
sem_destroy(&priv->devsem); sem_destroy(&priv->devsem);
#ifdef CONFIG_TOUCHSCREEN_MULTIPLE #ifdef CONFIG_TOUCHSCREEN_MULTIPLE
kfree(priv); kmm_free(priv);
#endif #endif
return ret; return ret;
} }

View File

@ -70,7 +70,7 @@ static int do_test_aes(FAR struct cipher_testvec* test, int mode, int encrypt)
res = memcmp(out, test->result, test->rlen); res = memcmp(out, test->result, test->rlen);
} }
kfree(out); kmm_free(out);
return res; return res;
} }

View File

@ -431,7 +431,7 @@ int i2schar_register(FAR struct i2s_dev_s *i2s, int minor)
* device. * device.
*/ */
kfree(priv); kmm_free(priv);
} }
/* Return the result of the registration */ /* Return the result of the registration */

View File

@ -1890,7 +1890,7 @@ struct audio_lowerhalf_s *vs1053_initialize(FAR struct spi_dev_s *spi,
if (id != VS1053_VER_VS1053) if (id != VS1053_VER_VS1053)
{ {
auddbg("Unexpected VER bits: 0x%0X\n", id); auddbg("Unexpected VER bits: 0x%0X\n", id);
kfree(dev); kmm_free(dev);
return NULL; return NULL;
} }
else else

View File

@ -2518,6 +2518,6 @@ FAR struct audio_lowerhalf_s *
errout_with_dev: errout_with_dev:
sem_destroy(&priv->pendsem); sem_destroy(&priv->pendsem);
kfree(priv); kmm_free(priv);
return NULL; return NULL;
} }

View File

@ -154,6 +154,6 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
return OK; return OK;
errout_with_bch: errout_with_bch:
kfree(bch); kmm_free(bch);
return ret; return ret;
} }

View File

@ -103,11 +103,11 @@ int bchlib_teardown(FAR void *handle)
if (bch->buffer) if (bch->buffer)
{ {
kfree(bch->buffer); kmm_free(bch->buffer);
} }
sem_destroy(&bch->sem); sem_destroy(&bch->sem);
kfree(bch); kmm_free(bch);
return OK; return OK;
} }

View File

@ -1306,7 +1306,7 @@ int ads7843e_register(FAR struct spi_dev_s *spi,
errout_with_priv: errout_with_priv:
sem_destroy(&priv->devsem); sem_destroy(&priv->devsem);
#ifdef CONFIG_ADS7843E_MULTIPLE #ifdef CONFIG_ADS7843E_MULTIPLE
kfree(priv); kmm_free(priv);
#endif #endif
return ret; return ret;
} }

View File

@ -1315,7 +1315,7 @@ int max11802_register(FAR struct spi_dev_s *spi,
errout_with_priv: errout_with_priv:
sem_destroy(&priv->devsem); sem_destroy(&priv->devsem);
#ifdef CONFIG_MAX11802_MULTIPLE #ifdef CONFIG_MAX11802_MULTIPLE
kfree(priv); kmm_free(priv);
#endif #endif
return ret; return ret;
} }

View File

@ -1819,7 +1819,7 @@ static int mxt_hwinitialize(FAR struct mxt_dev_s *priv)
/* Error exits */ /* Error exits */
errout_with_objtab: errout_with_objtab:
kfree(priv->objtab); kmm_free(priv->objtab);
priv->objtab = NULL; priv->objtab = NULL;
return ret; return ret;
@ -1923,13 +1923,13 @@ int mxt_register(FAR struct i2c_dev_s *i2c,
/* Error clean-up exits */ /* Error clean-up exits */
errout_with_hwinit: errout_with_hwinit:
kfree(priv->objtab); kmm_free(priv->objtab);
kfree(priv->sample); kmm_free(priv->sample);
errout_with_irq: errout_with_irq:
MXT_DETACH(lower); MXT_DETACH(lower);
errout_with_priv: errout_with_priv:
sem_destroy(&priv->devsem); sem_destroy(&priv->devsem);
sem_destroy(&priv->waitsem); sem_destroy(&priv->waitsem);
kfree(priv); kmm_free(priv);
return ret; return ret;
} }

View File

@ -339,7 +339,7 @@ STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_dev_s *dev,
if (ret < 0) if (ret < 0)
{ {
#ifdef CONFIG_STMPE811_MULTIPLE #ifdef CONFIG_STMPE811_MULTIPLE
kfree(priv); kmm_free(priv);
#endif #endif
return NULL; return NULL;
} }

View File

@ -1330,7 +1330,7 @@ int tsc2007_register(FAR struct i2c_dev_s *dev,
errout_with_priv: errout_with_priv:
sem_destroy(&priv->devsem); sem_destroy(&priv->devsem);
#ifdef CONFIG_TSC2007_MULTIPLE #ifdef CONFIG_TSC2007_MULTIPLE
kfree(priv); kmm_free(priv);
#endif #endif
return ret; return ret;
} }

View File

@ -441,7 +441,7 @@ int losetup(const char *devname, const char *filename, uint16_t sectsize,
errout_with_fd: errout_with_fd:
close(dev->fd); close(dev->fd);
errout_with_dev: errout_with_dev:
kfree(dev); kmm_free(dev);
return ret; return ret;
} }
@ -504,6 +504,6 @@ int loteardown(const char *devname)
(void)close(dev->fd); (void)close(dev->fd);
} }
kfree(dev); kmm_free(dev);
return ret; return ret;
} }

View File

@ -3190,7 +3190,7 @@ static void mmcsd_hwuninitialize(FAR struct mmcsd_state_s *priv)
{ {
mmcsd_removed(priv); mmcsd_removed(priv);
SDIO_RESET(priv->dev); SDIO_RESET(priv->dev);
kfree(priv); kmm_free(priv);
} }
} }
@ -3311,7 +3311,7 @@ errout_with_hwinit:
return ret; return ret;
errout_with_alloc: errout_with_alloc:
kfree(priv); kmm_free(priv);
return ret; return ret;
} }

View File

@ -700,7 +700,7 @@ FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev)
/* Unrecognized! Discard all of that work we just did and return NULL */ /* Unrecognized! Discard all of that work we just did and return NULL */
fdbg("ERROR: Unrecognized\n"); fdbg("ERROR: Unrecognized\n");
kfree(priv); kmm_free(priv);
priv = NULL; priv = NULL;
} }
else else

View File

@ -902,6 +902,6 @@ FAR struct mtd_dev_s *at45db_initialize(FAR struct spi_dev_s *spi)
errout: errout:
at45db_unlock(priv); at45db_unlock(priv);
kfree(priv); kmm_free(priv);
return NULL; return NULL;
} }

View File

@ -539,7 +539,7 @@ int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd)
if (ret < 0) if (ret < 0)
{ {
fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret); fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret);
kfree(dev); kmm_free(dev);
return ret; return ret;
} }
@ -550,7 +550,7 @@ int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd)
if (!dev->eblock) if (!dev->eblock)
{ {
fdbg("Failed to allocate an erase block buffer\n"); fdbg("Failed to allocate an erase block buffer\n");
kfree(dev); kmm_free(dev);
return -ENOMEM; return -ENOMEM;
} }
#endif #endif
@ -581,7 +581,7 @@ int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd)
if (ret < 0) if (ret < 0)
{ {
fdbg("rwb_initialize failed: %d\n", ret); fdbg("rwb_initialize failed: %d\n", ret);
kfree(dev); kmm_free(dev);
return ret; return ret;
} }
#endif #endif
@ -596,7 +596,7 @@ int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd)
if (ret < 0) if (ret < 0)
{ {
fdbg("register_blockdriver failed: %d\n", -ret); fdbg("register_blockdriver failed: %d\n", -ret);
kfree(dev); kmm_free(dev);
} }
} }
return ret; return ret;

View File

@ -1027,7 +1027,7 @@ FAR struct mtd_dev_s *m25p_initialize(FAR struct spi_dev_s *dev)
/* Unrecognized! Discard all of that work we just did and return NULL */ /* Unrecognized! Discard all of that work we just did and return NULL */
fdbg("Unrecognized\n"); fdbg("Unrecognized\n");
kfree(priv); kmm_free(priv);
priv = NULL; priv = NULL;
} }
} }

View File

@ -688,7 +688,7 @@ static off_t mtdconfig_ramconsolidate(FAR struct mtdconfig_struct_s *dev)
} }
errout: errout:
kfree(pBuf); kmm_free(pBuf);
return dst_offset; return dst_offset;
} }
@ -894,7 +894,7 @@ retry_relocate:
} }
errout: errout:
kfree(pBuf); kmm_free(pBuf);
return 0; return 0;
} }
#endif /* CONFIG_MTD_CONFIG_RAM_CONSOLIDATE */ #endif /* CONFIG_MTD_CONFIG_RAM_CONSOLIDATE */
@ -1203,7 +1203,7 @@ errout:
/* Free the buffer */ /* Free the buffer */
kfree(dev->buffer); kmm_free(dev->buffer);
return ret; return ret;
} }
@ -1263,7 +1263,7 @@ static int mtdconfig_getconfig(FAR struct mtdconfig_struct_s *dev,
errout: errout:
/* Free the buffer */ /* Free the buffer */
kfree(dev->buffer); kmm_free(dev->buffer);
return ret; return ret;
} }
@ -1356,7 +1356,7 @@ int mtdconfig_register(FAR struct mtd_dev_s *mtd)
if (ret < 0) if (ret < 0)
{ {
fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret); fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret);
kfree(dev); kmm_free(dev);
goto errout; goto errout;
} }

View File

@ -527,7 +527,7 @@ static int part_procfs_close(FAR struct file *filep)
/* Release the file attributes structure */ /* Release the file attributes structure */
kfree(attr); kmm_free(attr);
filep->f_priv = NULL; filep->f_priv = NULL;
return OK; return OK;
} }

View File

@ -186,7 +186,7 @@ static int mtd_close(FAR struct file *filep)
/* Release the file attributes structure */ /* Release the file attributes structure */
kfree(attr); kmm_free(attr);
filep->f_priv = NULL; filep->f_priv = NULL;
return OK; return OK;
} }

View File

@ -405,7 +405,7 @@ FAR struct mtd_dev_s *mtd_rwb_initialize(FAR struct mtd_dev_s *mtd)
if (ret < 0) if (ret < 0)
{ {
fdbg("ERROR: rwb_initialize failed: %d\n", ret); fdbg("ERROR: rwb_initialize failed: %d\n", ret);
kfree(priv); kmm_free(priv);
return NULL; return NULL;
} }
} }

View File

@ -713,7 +713,7 @@ FAR struct mtd_dev_s *ramtron_initialize(FAR struct spi_dev_s *dev)
{ {
/* Unrecognized! Discard all of that work we just did and return NULL */ /* Unrecognized! Discard all of that work we just did and return NULL */
kfree(priv); kmm_free(priv);
priv = NULL; priv = NULL;
} }
} }

View File

@ -630,7 +630,7 @@ FAR struct mtd_dev_s *s512_initialize(FAR struct mtd_dev_s *mtd)
/* Allocation failed! Discard all of that work we just did and return NULL */ /* Allocation failed! Discard all of that work we just did and return NULL */
fdbg("Allocation failed\n"); fdbg("Allocation failed\n");
kfree(priv); kmm_free(priv);
priv = NULL; priv = NULL;
} }
} }

View File

@ -502,12 +502,12 @@ static int smart_setsectorsize(struct smart_struct_s *dev, uint16_t size)
if (dev->sMap != NULL) if (dev->sMap != NULL)
{ {
kfree(dev->sMap); kmm_free(dev->sMap);
} }
if (dev->rwbuffer != NULL) if (dev->rwbuffer != NULL)
{ {
kfree(dev->rwbuffer); kmm_free(dev->rwbuffer);
} }
/* Allocate a virtual to physical sector map buffer. Also allocate /* Allocate a virtual to physical sector map buffer. Also allocate
@ -522,7 +522,7 @@ static int smart_setsectorsize(struct smart_struct_s *dev, uint16_t size)
if (!dev->sMap) if (!dev->sMap)
{ {
fdbg("Error allocating SMART virtual map buffer\n"); fdbg("Error allocating SMART virtual map buffer\n");
kfree(dev); kmm_free(dev);
return -EINVAL; return -EINVAL;
} }
@ -535,8 +535,8 @@ static int smart_setsectorsize(struct smart_struct_s *dev, uint16_t size)
if (!dev->rwbuffer) if (!dev->rwbuffer)
{ {
fdbg("Error allocating SMART read/write buffer\n"); fdbg("Error allocating SMART read/write buffer\n");
kfree(dev->sMap); kmm_free(dev->sMap);
kfree(dev); kmm_free(dev);
return -EINVAL; return -EINVAL;
} }
@ -2131,7 +2131,7 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, const char *partname)
if (ret < 0) if (ret < 0)
{ {
fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret); fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret);
kfree(dev); kmm_free(dev);
goto errout; goto errout;
} }
@ -2142,7 +2142,7 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, const char *partname)
ret = smart_setsectorsize(dev, CONFIG_MTD_SMART_SECTOR_SIZE); ret = smart_setsectorsize(dev, CONFIG_MTD_SMART_SECTOR_SIZE);
if (ret != OK) if (ret != OK)
{ {
kfree(dev); kmm_free(dev);
goto errout; goto errout;
} }
@ -2152,7 +2152,7 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, const char *partname)
if (totalsectors > 65534) if (totalsectors > 65534)
{ {
fdbg("SMART Sector size too small for device\n"); fdbg("SMART Sector size too small for device\n");
kfree(dev); kmm_free(dev);
ret = -EINVAL; ret = -EINVAL;
goto errout; goto errout;
} }
@ -2196,9 +2196,9 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, const char *partname)
if (rootdirdev == NULL) if (rootdirdev == NULL)
{ {
fdbg("register_blockdriver failed: %d\n", -ret); fdbg("register_blockdriver failed: %d\n", -ret);
kfree(dev->sMap); kmm_free(dev->sMap);
kfree(dev->rwbuffer); kmm_free(dev->rwbuffer);
kfree(dev); kmm_free(dev);
ret = -ENOMEM; ret = -ENOMEM;
goto errout; goto errout;
} }
@ -2227,9 +2227,9 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, const char *partname)
if (ret < 0) if (ret < 0)
{ {
fdbg("register_blockdriver failed: %d\n", -ret); fdbg("register_blockdriver failed: %d\n", -ret);
kfree(dev->sMap); kmm_free(dev->sMap);
kfree(dev->rwbuffer); kmm_free(dev->rwbuffer);
kfree(dev); kmm_free(dev);
goto errout; goto errout;
} }

View File

@ -1229,7 +1229,7 @@ FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev)
/* Unrecognized! Discard all of that work we just did and return NULL */ /* Unrecognized! Discard all of that work we just did and return NULL */
fdbg("Unrecognized\n"); fdbg("Unrecognized\n");
kfree(priv); kmm_free(priv);
priv = NULL; priv = NULL;
} }
else else
@ -1249,7 +1249,7 @@ FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev)
/* Allocation failed! Discard all of that work we just did and return NULL */ /* Allocation failed! Discard all of that work we just did and return NULL */
fdbg("Allocation failed\n"); fdbg("Allocation failed\n");
kfree(priv); kmm_free(priv);
priv = NULL; priv = NULL;
} }
#endif #endif

View File

@ -982,7 +982,7 @@ FAR struct mtd_dev_s *sst25xx_initialize(FAR struct spi_dev_s *dev)
/* Unrecognized! Discard all of that work we just did and return NULL */ /* Unrecognized! Discard all of that work we just did and return NULL */
fdbg("Unrecognized\n"); fdbg("Unrecognized\n");
kfree(priv); kmm_free(priv);
priv = NULL; priv = NULL;
} }
else else

View File

@ -1161,7 +1161,7 @@ FAR struct mtd_dev_s *w25_initialize(FAR struct spi_dev_s *spi)
/* Unrecognized! Discard all of that work we just did and return NULL */ /* Unrecognized! Discard all of that work we just did and return NULL */
fdbg("Unrecognized\n"); fdbg("Unrecognized\n");
kfree(priv); kmm_free(priv);
priv = NULL; priv = NULL;
} }
else else
@ -1181,7 +1181,7 @@ FAR struct mtd_dev_s *w25_initialize(FAR struct spi_dev_s *spi)
/* Allocation failed! Discard all of that work we just did and return NULL */ /* Allocation failed! Discard all of that work we just did and return NULL */
fdbg("Allocation failed\n"); fdbg("Allocation failed\n");
kfree(priv); kmm_free(priv);
priv = NULL; priv = NULL;
} }
#endif #endif

View File

@ -1119,7 +1119,7 @@ err1:
err0: err0:
rgmp_memunmap(mmio_base, mmio_size); rgmp_memunmap(mmio_base, mmio_size);
error: error:
kfree(dev); kmm_free(dev);
cprintf("e1000 device probe fail: %d\n", err); cprintf("e1000 device probe fail: %d\n", err);
return err; return err;
} }
@ -1154,7 +1154,7 @@ void e1000_mod_exit(void)
free(dev->tx_ring.desc); free(dev->tx_ring.desc);
pci_free_irq(dev->pci_addr); pci_free_irq(dev->pci_addr);
rgmp_memunmap((uintptr_t)dev->io_mem_base, dev->mem_size); rgmp_memunmap((uintptr_t)dev->io_mem_base, dev->mem_size);
kfree(dev); kmm_free(dev);
} }
e1000_list.next = NULL; e1000_list.next = NULL;

View File

@ -174,7 +174,7 @@ void pipecommon_freedev(FAR struct pipe_dev_s *dev)
sem_destroy(&dev->d_bfsem); sem_destroy(&dev->d_bfsem);
sem_destroy(&dev->d_rdsem); sem_destroy(&dev->d_rdsem);
sem_destroy(&dev->d_wrsem); sem_destroy(&dev->d_wrsem);
kfree(dev); kmm_free(dev);
} }
/**************************************************************************** /****************************************************************************
@ -333,7 +333,7 @@ int pipecommon_close(FAR struct file *filep)
{ {
/* Yes... deallocate the buffer */ /* Yes... deallocate the buffer */
kfree(dev->d_buffer); kmm_free(dev->d_buffer);
dev->d_buffer = NULL; dev->d_buffer = NULL;
/* And reset all counts and indices */ /* And reset all counts and indices */

View File

@ -553,7 +553,7 @@ FAR struct battery_dev_s *max1704x_initialize(FAR struct i2c_dev_s *i2c,
if (ret < 0) if (ret < 0)
{ {
batdbg("Failed to reset the MAX1704x: %d\n", ret); batdbg("Failed to reset the MAX1704x: %d\n", ret);
kfree(priv); kmm_free(priv);
return NULL; return NULL;
} }
#endif #endif

View File

@ -335,7 +335,7 @@ int romdisk_register(int minor, uint8_t *buffer, uint32_t nsectors,
if (ret < 0) if (ret < 0)
{ {
fdbg("register_blockdriver failed: %d\n", -ret); fdbg("register_blockdriver failed: %d\n", -ret);
kfree(dev); kmm_free(dev);
} }
} }

View File

@ -713,7 +713,7 @@ void rwb_uninitialize(FAR struct rwbuffer_s *rwb)
sem_destroy(&rwb->wrsem); sem_destroy(&rwb->wrsem);
if (rwb->wrbuffer) if (rwb->wrbuffer)
{ {
kfree(rwb->wrbuffer); kmm_free(rwb->wrbuffer);
} }
} }
#endif #endif
@ -724,7 +724,7 @@ void rwb_uninitialize(FAR struct rwbuffer_s *rwb)
sem_destroy(&rwb->rhsem); sem_destroy(&rwb->rhsem);
if (rwb->rhbuffer) if (rwb->rhbuffer)
{ {
kfree(rwb->rhbuffer); kmm_free(rwb->rhbuffer);
} }
} }
#endif #endif

View File

@ -270,7 +270,7 @@ FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_dev_s *i2c,
/* Error exit */ /* Error exit */
kfree(dev); kmm_free(dev);
errno = retval; errno = retval;
return NULL; return NULL;
} }
@ -280,7 +280,7 @@ int lis331dl_deinit(FAR struct lis331dl_dev_s * dev)
ASSERT(dev); ASSERT(dev);
lis331dl_powerdown(dev); lis331dl_powerdown(dev);
kfree(dev); kmm_free(dev);
return OK; return OK;
} }

View File

@ -531,7 +531,7 @@ int lm75_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c, uint8_t ad
if (ret < 0) if (ret < 0)
{ {
lm75dbg("Failed to register driver: %d\n", ret); lm75dbg("Failed to register driver: %d\n", ret);
kfree(priv); kmm_free(priv);
} }
return ret; return ret;

View File

@ -671,7 +671,7 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen)
ret = register_driver(devpath, &g_ramlogfops, 0666, priv); ret = register_driver(devpath, &g_ramlogfops, 0666, priv);
if (ret < 0) if (ret < 0)
{ {
kfree(priv); kmm_free(priv);
} }
} }

View File

@ -516,11 +516,11 @@ FAR void *timer_register(FAR const char *path,
return (FAR void *)upper; return (FAR void *)upper;
errout_with_path: errout_with_path:
kfree(upper->path); kmm_free(upper->path);
errout_with_upper: errout_with_upper:
//sem_destroy(&upper->exclsem); //sem_destroy(&upper->exclsem);
kfree(upper); kmm_free(upper);
errout: errout:
return NULL; return NULL;
@ -565,9 +565,9 @@ void timer_unregister(FAR void *handle)
/* Then free all of the driver resources */ /* Then free all of the driver resources */
kfree(upper->path); kmm_free(upper->path);
//sem_destroy(&upper->exclsem); //sem_destroy(&upper->exclsem);
kfree(upper); kmm_free(upper);
} }
#endif /* CONFIG_TIMER */ #endif /* CONFIG_TIMER */

View File

@ -2310,7 +2310,7 @@ int cdcacm_classobject(int minor, FAR struct usbdevclass_driver_s **classdev)
return OK; return OK;
errout_with_class: errout_with_class:
kfree(alloc); kmm_free(alloc);
return ret; return ret;
} }
@ -2415,7 +2415,7 @@ void cdcacm_uninitialize(FAR void *handle)
* free the memory resources. * free the memory resources.
*/ */
kfree(priv); kmm_free(priv);
return; return;
} }
#endif #endif
@ -2445,7 +2445,7 @@ void cdcacm_uninitialize(FAR void *handle)
/* And free the driver structure */ /* And free the driver structure */
kfree(priv); kmm_free(priv);
#else #else
/* For the case of the composite driver, there is a two pass /* For the case of the composite driver, there is a two pass

View File

@ -851,7 +851,7 @@ FAR void *composite_initialize(void)
return (FAR void *)alloc; return (FAR void *)alloc;
errout_with_alloc: errout_with_alloc:
kfree(alloc); kmm_free(alloc);
return NULL; return NULL;
} }
@ -901,7 +901,7 @@ void composite_uninitialize(FAR void *handle)
/* Then free the composite driver state structure itself */ /* Then free the composite driver state structure itself */
kfree(priv); kmm_free(priv);
} }
/**************************************************************************** /****************************************************************************

View File

@ -2368,6 +2368,6 @@ int usbdev_serialinitialize(int minor)
errout_with_class: errout_with_class:
usbdev_unregister(&drvr->drvr); usbdev_unregister(&drvr->drvr);
errout_with_alloc: errout_with_alloc:
kfree(alloc); kmm_free(alloc);
return ret; return ret;
} }

View File

@ -1771,7 +1771,7 @@ void usbmsc_uninitialize(FAR void *handle)
* free the memory resources. * free the memory resources.
*/ */
kfree(priv); kmm_free(priv);
return; return;
} }
#endif #endif
@ -1818,13 +1818,13 @@ void usbmsc_uninitialize(FAR void *handle)
usbmsc_lununinitialize(&priv->luntab[i]); usbmsc_lununinitialize(&priv->luntab[i]);
} }
kfree(priv->luntab); kmm_free(priv->luntab);
/* Release the I/O buffer */ /* Release the I/O buffer */
if (priv->iobuffer) if (priv->iobuffer)
{ {
kfree(priv->iobuffer); kmm_free(priv->iobuffer);
} }
/* Uninitialize and release the driver structure */ /* Uninitialize and release the driver structure */
@ -1840,6 +1840,6 @@ void usbmsc_uninitialize(FAR void *handle)
* second pass because of priv->thpid == 0) * second pass because of priv->thpid == 0)
*/ */
kfree(priv); kmm_free(priv);
#endif #endif
} }

View File

@ -1,333 +1,333 @@
/******************************************************************************* /*******************************************************************************
* drivers/usbhost/usbhost_devaddr.c * drivers/usbhost/usbhost_devaddr.c
* Manage USB device addresses * Manage USB device addresses
* *
* Copyright (C) 2013 Gregory Nutt. All rights reserved. * Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org> * Authors: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* *
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
* 3. Neither the name NuttX nor the names of its contributors may be * 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software * used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
*******************************************************************************/ *******************************************************************************/
/******************************************************************************* /*******************************************************************************
* Included Files * Included Files
*******************************************************************************/ *******************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>
#include <nuttx/usb/usbhost_devaddr.h> #include <nuttx/usb/usbhost_devaddr.h>
/******************************************************************************* /*******************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
*******************************************************************************/ *******************************************************************************/
/******************************************************************************* /*******************************************************************************
* Private Functions * Private Functions
*******************************************************************************/ *******************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: usbhost_takesem and usbhost_givesem * Name: usbhost_takesem and usbhost_givesem
* *
* Description: * Description:
* This is just a wrapper to handle the annoying behavior of semaphore * This is just a wrapper to handle the annoying behavior of semaphore
* waits that return due to the receipt of a signal. * waits that return due to the receipt of a signal.
* *
*******************************************************************************/ *******************************************************************************/
static void usbhost_takesem(FAR struct usbhost_devaddr_s *hcd) static void usbhost_takesem(FAR struct usbhost_devaddr_s *hcd)
{ {
/* Take the semaphore (perhaps waiting) */ /* Take the semaphore (perhaps waiting) */
while (sem_wait(&hcd->exclsem) != 0) while (sem_wait(&hcd->exclsem) != 0)
{ {
/* The only case that an error should occr here is if the wait was /* The only case that an error should occr here is if the wait was
* awakened by a signal. * awakened by a signal.
*/ */
ASSERT(errno == EINTR); ASSERT(errno == EINTR);
} }
} }
#define usbhost_givesem(hcd) sem_post(&hcd->exclsem) #define usbhost_givesem(hcd) sem_post(&hcd->exclsem)
/******************************************************************************* /*******************************************************************************
* Name: usbhost_devaddr_hash * Name: usbhost_devaddr_hash
* *
* Description: * Description:
* Create a hash value from a device address. * Create a hash value from a device address.
* *
*******************************************************************************/ *******************************************************************************/
static inline uint8_t usbhost_devaddr_hash(uint8_t devaddr) static inline uint8_t usbhost_devaddr_hash(uint8_t devaddr)
{ {
uint8_t ret = devaddr; uint8_t ret = devaddr;
ret ^= (devaddr >> 2); ret ^= (devaddr >> 2);
ret ^= (devaddr >> 3); ret ^= (devaddr >> 3);
return ret & USBHOST_DEVADDR_HASHMASK; return ret & USBHOST_DEVADDR_HASHMASK;
} }
/******************************************************************************* /*******************************************************************************
* Name: usbhost_devaddr_allocate * Name: usbhost_devaddr_allocate
* *
* Description: * Description:
* Allocate a new unique device address for this HCD. * Allocate a new unique device address for this HCD.
* *
* Assumptions: * Assumptions:
* Caller hold the exclsem * Caller hold the exclsem
* *
*******************************************************************************/ *******************************************************************************/
static int usbhost_devaddr_allocate(FAR struct usbhost_devaddr_s *hcd) static int usbhost_devaddr_allocate(FAR struct usbhost_devaddr_s *hcd)
{ {
uint8_t startaddr = hcd->next; uint8_t startaddr = hcd->next;
uint8_t devaddr; uint8_t devaddr;
int index; int index;
int bitno; int bitno;
/* Loop until we find a valid device address */ /* Loop until we find a valid device address */
for (;;) for (;;)
{ {
/* Try the next device address */ /* Try the next device address */
devaddr = hcd->next; devaddr = hcd->next;
if (hcd->next >= 0x7f) if (hcd->next >= 0x7f)
{ {
hcd->next = 1; hcd->next = 1;
} }
else else
{ {
hcd->next++; hcd->next++;
} }
/* Is this address already allocated? */ /* Is this address already allocated? */
index = devaddr >> 5; index = devaddr >> 5;
bitno = devaddr & 0x1f; bitno = devaddr & 0x1f;
if ((hcd->alloctab[index] & (1 << bitno)) == 0) if ((hcd->alloctab[index] & (1 << bitno)) == 0)
{ {
/* No... allocate it now */ /* No... allocate it now */
hcd->alloctab[index] |= (1 << bitno); hcd->alloctab[index] |= (1 << bitno);
return (int)devaddr; return (int)devaddr;
} }
/* This address has already been allocated. The followign logic will /* This address has already been allocated. The followign logic will
* prevent (unexpected) infinite loops. * prevent (unexpected) infinite loops.
*/ */
if (startaddr == devaddr) if (startaddr == devaddr)
{ {
/* We are back where we started... the are no free device address */ /* We are back where we started... the are no free device address */
return -ENOMEM; return -ENOMEM;
} }
} }
} }
/******************************************************************************* /*******************************************************************************
* Public Functions * Public Functions
*******************************************************************************/ *******************************************************************************/
/******************************************************************************* /*******************************************************************************
* Name: usbhost_devaddr_initialize * Name: usbhost_devaddr_initialize
* *
* Description: * Description:
* Initialize the caller provided struct usbhost_devaddr_s instance in * Initialize the caller provided struct usbhost_devaddr_s instance in
* preparation for the management of device addresses on behalf of an HCD. * preparation for the management of device addresses on behalf of an HCD.
* *
*******************************************************************************/ *******************************************************************************/
void usbhost_devaddr_initialize(FAR struct usbhost_devaddr_s *hcd) void usbhost_devaddr_initialize(FAR struct usbhost_devaddr_s *hcd)
{ {
DEBUGASSERT(hcd); DEBUGASSERT(hcd);
memset(hcd, 0, sizeof(struct usbhost_devaddr_s)); memset(hcd, 0, sizeof(struct usbhost_devaddr_s));
sem_init(&hcd->exclsem, 0, 1); sem_init(&hcd->exclsem, 0, 1);
hcd->next = 1; hcd->next = 1;
} }
/******************************************************************************* /*******************************************************************************
* Name: usbhost_devaddr_create * Name: usbhost_devaddr_create
* *
* Description: * Description:
* Create a new unique device address for this HCD. Bind the void* arg to the * Create a new unique device address for this HCD. Bind the void* arg to the
* the device address and return the newly allocated device address. * the device address and return the newly allocated device address.
* *
*******************************************************************************/ *******************************************************************************/
int usbhost_devaddr_create(FAR struct usbhost_devaddr_s *hcd, int usbhost_devaddr_create(FAR struct usbhost_devaddr_s *hcd,
FAR void *associate) FAR void *associate)
{ {
FAR struct usbhost_devhash_s *hentry; FAR struct usbhost_devhash_s *hentry;
uint8_t hvalue; uint8_t hvalue;
int devaddr; int devaddr;
/* Allocate a hash table entry */ /* Allocate a hash table entry */
hentry = (FAR struct usbhost_devhash_s *)kmalloc(sizeof(struct usbhost_devhash_s)); hentry = (FAR struct usbhost_devhash_s *)kmalloc(sizeof(struct usbhost_devhash_s));
if (!hentry) if (!hentry)
{ {
udbg("ERROR: Failed to allocate a hash table entry\n"); udbg("ERROR: Failed to allocate a hash table entry\n");
return -ENOMEM; return -ENOMEM;
} }
/* Get exclusive access to the HCD device address data */ /* Get exclusive access to the HCD device address data */
usbhost_takesem(hcd); usbhost_takesem(hcd);
/* Allocate a device address */ /* Allocate a device address */
devaddr = usbhost_devaddr_allocate(hcd); devaddr = usbhost_devaddr_allocate(hcd);
if (devaddr < 0) if (devaddr < 0)
{ {
udbg("ERROR: Failed to allocate a device address\n"); udbg("ERROR: Failed to allocate a device address\n");
free(hentry); free(hentry);
} }
else else
{ {
/* Initialize the hash table entry */ /* Initialize the hash table entry */
hentry->devaddr = devaddr; hentry->devaddr = devaddr;
hentry->payload = associate; hentry->payload = associate;
/* Add the new device address to the hash table */ /* Add the new device address to the hash table */
hvalue = usbhost_devaddr_hash(devaddr); hvalue = usbhost_devaddr_hash(devaddr);
hentry->flink = hcd->hashtab[hvalue]; hentry->flink = hcd->hashtab[hvalue];
hcd->hashtab[hvalue] = hentry; hcd->hashtab[hvalue] = hentry;
/* Try to re-use the lowest numbered device addresses */ /* Try to re-use the lowest numbered device addresses */
if (hcd->next > devaddr) if (hcd->next > devaddr)
{ {
hcd->next = devaddr; hcd->next = devaddr;
} }
} }
usbhost_givesem(hcd); usbhost_givesem(hcd);
return devaddr; return devaddr;
} }
/******************************************************************************* /*******************************************************************************
* Name: usbhost_devaddr_find * Name: usbhost_devaddr_find
* *
* Description: * Description:
* Given a device address, find the void* value that was bound to the device * Given a device address, find the void* value that was bound to the device
* address by usbhost_devaddr_create() when the device address was allocated. * address by usbhost_devaddr_create() when the device address was allocated.
* *
*******************************************************************************/ *******************************************************************************/
FAR void *usbhost_devaddr_find(FAR struct usbhost_devaddr_s *hcd, FAR void *usbhost_devaddr_find(FAR struct usbhost_devaddr_s *hcd,
uint8_t devaddr) uint8_t devaddr)
{ {
FAR struct usbhost_devhash_s *hentry; FAR struct usbhost_devhash_s *hentry;
uint8_t hvalue; uint8_t hvalue;
/* Get exclusive access to the HCD device address data */ /* Get exclusive access to the HCD device address data */
hvalue = usbhost_devaddr_hash(devaddr); hvalue = usbhost_devaddr_hash(devaddr);
usbhost_takesem(hcd); usbhost_takesem(hcd);
/* Check each entry in the hash table */ /* Check each entry in the hash table */
for (hentry = hcd->hashtab[hvalue]; hentry; hentry = hentry->flink) for (hentry = hcd->hashtab[hvalue]; hentry; hentry = hentry->flink)
{ {
/* Is this the address we are looking for? */ /* Is this the address we are looking for? */
if (hentry->devaddr == devaddr) if (hentry->devaddr == devaddr)
{ {
/* Yes.. return the payload from the hash table entry */ /* Yes.. return the payload from the hash table entry */
usbhost_givesem(hcd); usbhost_givesem(hcd);
return hentry->payload; return hentry->payload;
} }
} }
/* Didn't find the device address */ /* Didn't find the device address */
usbhost_givesem(hcd); usbhost_givesem(hcd);
return NULL; return NULL;
} }
/******************************************************************************* /*******************************************************************************
* Name: usbhost_devaddr_destroy * Name: usbhost_devaddr_destroy
* *
* Description: * Description:
* Release a device address previously allocated by usbhost_devaddr_destroy() * Release a device address previously allocated by usbhost_devaddr_destroy()
* and destroy the association with the void* data. * and destroy the association with the void* data.
* *
*******************************************************************************/ *******************************************************************************/
void usbhost_devaddr_destroy(FAR struct usbhost_devaddr_s *hcd, uint8_t devaddr) void usbhost_devaddr_destroy(FAR struct usbhost_devaddr_s *hcd, uint8_t devaddr)
{ {
FAR struct usbhost_devhash_s *hentry; FAR struct usbhost_devhash_s *hentry;
FAR struct usbhost_devhash_s *prev; FAR struct usbhost_devhash_s *prev;
uint8_t hvalue; uint8_t hvalue;
/* Get exclusive access to the HCD device address data */ /* Get exclusive access to the HCD device address data */
hvalue = usbhost_devaddr_hash(devaddr); hvalue = usbhost_devaddr_hash(devaddr);
usbhost_takesem(hcd); usbhost_takesem(hcd);
/* Search the hast table for the matching entry */ /* Search the hast table for the matching entry */
for (hentry = hcd->hashtab[hvalue], prev = NULL; for (hentry = hcd->hashtab[hvalue], prev = NULL;
hentry; hentry;
prev = hentry, hentry = hentry->flink) prev = hentry, hentry = hentry->flink)
{ {
/* Is this the address we are looking for? */ /* Is this the address we are looking for? */
if (hentry->devaddr == devaddr) if (hentry->devaddr == devaddr)
{ {
/* Yes.. remove the entry from the hash list */ /* Yes.. remove the entry from the hash list */
if (prev) if (prev)
{ {
prev->flink = hentry->flink; prev->flink = hentry->flink;
} }
else else
{ {
hcd->hashtab[hvalue] = hentry->flink; hcd->hashtab[hvalue] = hentry->flink;
} }
/* And release the entry */ /* And release the entry */
kfree(hentry); kmm_free(hentry);
break; break;
} }
} }
usbhost_givesem(hcd); usbhost_givesem(hcd);
} }

View File

@ -690,7 +690,7 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *class)
/* Free the class instance. */ /* Free the class instance. */
uvdbg("Freeing: %p\n", class);; uvdbg("Freeing: %p\n", class);;
kfree(class); kmm_free(class);
} }
/**************************************************************************** /****************************************************************************

View File

@ -545,7 +545,7 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *class)
/* Free the class instance. */ /* Free the class instance. */
uvdbg("Freeing: %p\n", class);; uvdbg("Freeing: %p\n", class);;
kfree(class); kmm_free(class);
} }
/**************************************************************************** /****************************************************************************

View File

@ -276,12 +276,12 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *class)
{ {
DEBUGASSERT(class != NULL); DEBUGASSERT(class != NULL);
/* Free the class instance (perhaps calling sched_kfree() in case we are /* Free the class instance (perhaps calling sched_kmm_free() in case we are
* executing from an interrupt handler. * executing from an interrupt handler.
*/ */
uvdbg("Freeing: %p\n", class);; uvdbg("Freeing: %p\n", class);;
kfree(class); kmm_free(class);
} }
/**************************************************************************** /****************************************************************************

View File

@ -433,12 +433,12 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *class)
{ {
DEBUGASSERT(class != NULL); DEBUGASSERT(class != NULL);
/* Free the class instance (calling sched_kfree() in case we are executing /* Free the class instance (calling sched_kmm_free() in case we are executing
* from an interrupt handler. * from an interrupt handler.
*/ */
uvdbg("Freeing: %p\n", class);; uvdbg("Freeing: %p\n", class);;
kfree(class); kmm_free(class);
} }
#endif #endif

View File

@ -518,11 +518,11 @@ FAR void *watchdog_register(FAR const char *path,
return (FAR void *)upper; return (FAR void *)upper;
errout_with_path: errout_with_path:
kfree(upper->path); kmm_free(upper->path);
errout_with_upper: errout_with_upper:
sem_destroy(&upper->exclsem); sem_destroy(&upper->exclsem);
kfree(upper); kmm_free(upper);
errout: errout:
return NULL; return NULL;
@ -567,9 +567,9 @@ void watchdog_unregister(FAR void *handle)
/* Then free all of the driver resources */ /* Then free all of the driver resources */
kfree(upper->path); kmm_free(upper->path);
sem_destroy(&upper->exclsem); sem_destroy(&upper->exclsem);
kfree(upper); kmm_free(upper);
} }
#endif /* CONFIG_WATCHDOG */ #endif /* CONFIG_WATCHDOG */

View File

@ -520,7 +520,7 @@ struct cc1101_dev_s * cc1101_init(struct spi_dev_s * spi, uint8_t isrpin,
if (cc1101_reset(dev) < 0) if (cc1101_reset(dev) < 0)
{ {
kfree(dev); kmm_free(dev);
errno = EFAULT; errno = EFAULT;
return NULL; return NULL;
} }
@ -529,7 +529,7 @@ struct cc1101_dev_s * cc1101_init(struct spi_dev_s * spi, uint8_t isrpin,
if (cc1101_checkpart(dev) < 0) if (cc1101_checkpart(dev) < 0)
{ {
kfree(dev); kmm_free(dev);
errno = ENODEV; errno = ENODEV;
return NULL; return NULL;
} }
@ -579,7 +579,7 @@ int cc1101_deinit(struct cc1101_dev_s * dev)
/* Release external interrupt line */ /* Release external interrupt line */
kfree(dev); kmm_free(dev);
return 0; return 0;
} }

View File

@ -983,7 +983,7 @@ static int cc3000_close(FAR struct file *filep)
mq_close(priv->queue); mq_close(priv->queue);
priv->queue = 0; priv->queue = 0;
kfree(priv->rx_buffer.pbuffer); kmm_free(priv->rx_buffer.pbuffer);
priv->rx_buffer.pbuffer = 0; priv->rx_buffer.pbuffer = 0;
} }
@ -1598,7 +1598,7 @@ errout_with_priv:
#endif #endif
#ifdef CONFIG_CC3000_MULTIPLE #ifdef CONFIG_CC3000_MULTIPLE
kfree(priv); kmm_free(priv);
#endif #endif
return ret; return ret;
} }

View File

@ -1198,9 +1198,9 @@ static int nrf24l01_unregister(FAR struct nrf24l01_dev_s *dev)
/* Free memory */ /* Free memory */
#ifdef CONFIG_WL_NRF24L01_RXSUPPORT #ifdef CONFIG_WL_NRF24L01_RXSUPPORT
kfree(dev->rx_fifo); kmm_free(dev->rx_fifo);
#endif #endif
kfree(dev); kmm_free(dev);
return OK; return OK;
} }
@ -1244,7 +1244,7 @@ int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *c
#ifdef CONFIG_WL_NRF24L01_RXSUPPORT #ifdef CONFIG_WL_NRF24L01_RXSUPPORT
if ((rx_fifo = kmalloc(CONFIG_WL_NRF24L01_RXFIFO_LEN)) == NULL) if ((rx_fifo = kmalloc(CONFIG_WL_NRF24L01_RXFIFO_LEN)) == NULL)
{ {
kfree(dev); kmm_free(dev);
return -ENOMEM; return -ENOMEM;
} }

View File

@ -363,7 +363,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
off_t offset = fat_seek(filep, ff->ff_size, SEEK_SET); off_t offset = fat_seek(filep, ff->ff_size, SEEK_SET);
if (offset < 0) if (offset < 0)
{ {
kfree(ff); kmm_free(ff);
return (int)offset; return (int)offset;
} }
} }
@ -375,7 +375,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
*/ */
errout_with_struct: errout_with_struct:
kfree(ff); kmm_free(ff);
errout_with_semaphore: errout_with_semaphore:
fat_semgive(fs); fat_semgive(fs);
@ -425,7 +425,7 @@ static int fat_close(FAR struct file *filep)
/* Then free the file structure itself. */ /* Then free the file structure itself. */
kfree(ff); kmm_free(ff);
filep->f_priv = NULL; filep->f_priv = NULL;
return ret; return ret;
} }
@ -1417,7 +1417,7 @@ static int fat_dup(FAR const struct file *oldp, FAR struct file *newp)
*/ */
errout_with_struct: errout_with_struct:
kfree(newff); kmm_free(newff);
errout_with_semaphore: errout_with_semaphore:
fat_semgive(fs); fat_semgive(fs);
@ -1778,7 +1778,7 @@ static int fat_bind(FAR struct inode *blkdriver, const void *data,
if (ret != 0) if (ret != 0)
{ {
sem_destroy(&fs->fs_sem); sem_destroy(&fs->fs_sem);
kfree(fs); kmm_free(fs);
return ret; return ret;
} }
@ -1849,7 +1849,7 @@ static int fat_unbind(void *handle, FAR struct inode **blkdriver)
fat_io_free(fs->fs_buffer, fs->fs_hwsectorsize); fat_io_free(fs->fs_buffer, fs->fs_hwsectorsize);
} }
kfree(fs); kmm_free(fs);
} }
fat_semgive(fs); fat_semgive(fs);

View File

@ -701,8 +701,8 @@
# define fat_io_alloc(s) fat_dma_alloc(s) # define fat_io_alloc(s) fat_dma_alloc(s)
# define fat_io_free(m,s) fat_dma_free(m,s) # define fat_io_free(m,s) fat_dma_free(m,s)
#else #else
# define fat_io_alloc(s) kmalloc(s) # define fat_io_alloc(s) kmm_malloc(s)
# define fat_io_free(m,s) kfree(m) # define fat_io_free(m,s) kmm_free(m)
#endif #endif
/**************************************************************************** /****************************************************************************

View File

@ -319,7 +319,7 @@ errout:
if (var.fv_sect) if (var.fv_sect)
{ {
kfree(var.fv_sect); kmm_free(var.fv_sect);
} }
/* Return any reported errors */ /* Return any reported errors */

View File

@ -633,5 +633,5 @@ void automount_uninitialize(FAR void *handle)
/* And free the state structure */ /* And free the state structure */
kfree(priv); kmm_free(priv);
} }

View File

@ -208,7 +208,7 @@ int foreach_inode(foreach_inode_t handler, FAR void *arg)
/* Free the info structure and return the result */ /* Free the info structure and return the result */
kfree(info); kmm_free(info);
return ret; return ret;
#else #else

View File

@ -400,7 +400,7 @@ void inode_free(FAR struct inode *node)
{ {
inode_free(node->i_peer); inode_free(node->i_peer);
inode_free(node->i_child); inode_free(node->i_child);
kfree(node); kmm_free(node);
} }
} }

View File

@ -95,7 +95,7 @@ void inode_release(FAR struct inode *node)
{ {
inode_semgive(); inode_semgive();
inode_free(node->i_child); inode_free(node->i_child);
kfree(node); kmm_free(node);
} }
else else
{ {

Some files were not shown because too many files have changed in this diff Show More