diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-31 17:04:02 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-31 17:04:02 -0600 |
commit | 7482b7ad0f60724e593a8919783444ef79f4c79e (patch) | |
tree | 396e7019c35eb0f49f430c1132972eedc292a752 | |
parent | 2ad3a4c2a2b56a721180faa3c689110d86d90359 (diff) | |
download | nuttx-7482b7ad0f60724e593a8919783444ef79f4c79e.tar.gz nuttx-7482b7ad0f60724e593a8919783444ef79f4c79e.tar.bz2 nuttx-7482b7ad0f60724e593a8919783444ef79f4c79e.zip |
Rename kfree to kmm_free for consistency with other naming conventions
137 files changed, 646 insertions, 641 deletions
diff --git a/nuttx/Documentation/NuttXBinfmt.html b/nuttx/Documentation/NuttXBinfmt.html index c87e6cd89..cb6be7e6f 100644 --- a/nuttx/Documentation/NuttXBinfmt.html +++ b/nuttx/Documentation/NuttXBinfmt.html @@ -410,7 +410,7 @@ FAR char *exepath_next(EXEPATH_HANDLE handle, FAR const char *relpath); </p> <p> 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> <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. diff --git a/nuttx/arch/arm/src/dm320/dm320_framebuffer.c b/nuttx/arch/arm/src/dm320/dm320_framebuffer.c index 1abc02802..5f8597969 100644 --- a/nuttx/arch/arm/src/dm320/dm320_framebuffer.c +++ b/nuttx/arch/arm/src/dm320/dm320_framebuffer.c @@ -726,7 +726,7 @@ static void dm320_freevideomemory(void) #ifndef CONFIG_DM320_VID0_DISABLE if (g_vid0base) { - kfree(g_vid0base); + kmm_free(g_vid0base); g_vid0base = NULL; #ifndef CONFIG_DM320_DISABLE_PINGPONG g_vid0ppbase = NULL; @@ -737,7 +737,7 @@ static void dm320_freevideomemory(void) #ifndef CONFIG_DM320_VID1_DISABLE if (g_vid1base != 0) { - kfree(g_vid1base); + kmm_free(g_vid1base); g_vid1base = NULL; } #endif @@ -745,7 +745,7 @@ static void dm320_freevideomemory(void) #ifndef CONFIG_DM320_OSD0_DISABLE if (g_osd0base != 0) { - kfree(g_osd0base); + kmm_free(g_osd0base); g_osd0base = NULL; } #endif @@ -753,7 +753,7 @@ static void dm320_freevideomemory(void) #ifndef CONFIG_DM320_OSD1_DISABLE if (g_osd1base != 0) { - kfree(g_osd1base); + kmm_free(g_osd1base); g_osd1base = NULL; } #endif diff --git a/nuttx/arch/arm/src/dm320/dm320_usbdev.c b/nuttx/arch/arm/src/dm320/dm320_usbdev.c index 699a68edf..b04b732e0 100644 --- a/nuttx/arch/arm/src/dm320/dm320_usbdev.c +++ b/nuttx/arch/arm/src/dm320/dm320_usbdev.c @@ -1969,7 +1969,7 @@ static void dm320_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s #endif 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 usbdev_dma_free(buf); #else - kfree(buf); + kmm_free(buf); #endif } #endif diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c b/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c index 7dbb2170b..218b58021 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c @@ -2691,7 +2691,7 @@ static void lpc17_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s #endif 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 usbtrace(TRACE_EPFREEBUFFER, privep->epphy); - kfree(buf); + kmm_free(buf); #endif } diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c b/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c index c9e1a3a7a..56ca38b6c 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c @@ -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 * be accessed more efficiently. This method provides a mechanism to free that * 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: * 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 * efficiently. This method provides a mechanism to free that IO buffer * 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: * drvr - The USB host driver instance obtained as a parameter from the call to diff --git a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c index fcc6d90c6..c01813e1a 100644 --- a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c +++ b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c @@ -2655,7 +2655,7 @@ static void lpc214x_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_ #endif 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 usbtrace(TRACE_EPFREEBUFFER, privep->epphy); - kfree(buf); + kmm_free(buf); #endif } diff --git a/nuttx/arch/arm/src/lpc31xx/lpc31_ehci.c b/nuttx/arch/arm/src/lpc31xx/lpc31_ehci.c index 8f0091f8a..e460241e5 100755 --- a/nuttx/arch/arm/src/lpc31xx/lpc31_ehci.c +++ b/nuttx/arch/arm/src/lpc31xx/lpc31_ehci.c @@ -3679,7 +3679,7 @@ static int lpc31_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) /* Free the container */ - kfree(epinfo); + kmm_free(epinfo); 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 * can be accessed more efficiently. This method provides a mechanism to * 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: * 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 */ - kfree(buffer); + kmm_free(buffer); return OK; } @@ -4279,7 +4279,7 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller) if (!g_qtdpool) { usbhost_trace1(EHCI_TRACE1_QTDPOOLALLOC_FAILED, 0); - kfree(g_qhpool); + kmm_free(g_qhpool); return NULL; } #endif @@ -4292,8 +4292,8 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller) if (!g_framelist) { usbhost_trace1(EHCI_TRACE1_PERFLALLOC_FAILED, 0); - kfree(g_qhpool); - kfree(g_qtdpool); + kmm_free(g_qhpool); + kmm_free(g_qtdpool); return NULL; } #endif diff --git a/nuttx/arch/arm/src/lpc31xx/lpc31_usbdev.c b/nuttx/arch/arm/src/lpc31xx/lpc31_usbdev.c index ba1e0c240..748430dbe 100644 --- a/nuttx/arch/arm/src/lpc31xx/lpc31_usbdev.c +++ b/nuttx/arch/arm/src/lpc31xx/lpc31_usbdev.c @@ -1982,7 +1982,7 @@ static void lpc31_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s #endif 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 usbdev_dma_free(buf); #else - kfree(buf); + kmm_free(buf); #endif } #endif diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_usb0dev.c b/nuttx/arch/arm/src/lpc43xx/lpc43_usb0dev.c index c17f075b6..eeba3b443 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_usb0dev.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_usb0dev.c @@ -1982,7 +1982,7 @@ static void lpc43_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s #endif 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 usbdev_dma_free(buf); #else - kfree(buf); + kmm_free(buf); #endif } #endif diff --git a/nuttx/arch/arm/src/sam34/sam_emac.c b/nuttx/arch/arm/src/sam34/sam_emac.c index 0dc5fb783..bb0e1ff2d 100644 --- a/nuttx/arch/arm/src/sam34/sam_emac.c +++ b/nuttx/arch/arm/src/sam34/sam_emac.c @@ -657,25 +657,25 @@ static void sam_buffer_free(struct sam_emac_s *priv) if (priv->txdesc) { - kfree(priv->txdesc); + kmm_free(priv->txdesc); priv->txdesc = NULL; } if (priv->rxdesc) { - kfree(priv->rxdesc); + kmm_free(priv->rxdesc); priv->rxdesc = NULL; } if (priv->txbuffer) { - kfree(priv->txbuffer); + kmm_free(priv->txbuffer); priv->txbuffer = NULL; } if (priv->rxbuffer) { - kfree(priv->rxbuffer); + kmm_free(priv->rxbuffer); priv->rxbuffer = NULL; } #endif diff --git a/nuttx/arch/arm/src/sam34/sam_udp.c b/nuttx/arch/arm/src/sam34/sam_udp.c index a502fb35b..a1cc83bdd 100644 --- a/nuttx/arch/arm/src/sam34/sam_udp.c +++ b/nuttx/arch/arm/src/sam34/sam_udp.c @@ -3019,7 +3019,7 @@ static void sam_ep_freereq(struct usbdev_ep_s *ep, struct usbdev_req_s *req) #endif usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog)); - kfree(privreq); + kmm_free(privreq); } /**************************************************************************** diff --git a/nuttx/arch/arm/src/sama5/sam_ehci.c b/nuttx/arch/arm/src/sama5/sam_ehci.c index 72dfd347a..f0706a8c9 100755 --- a/nuttx/arch/arm/src/sama5/sam_ehci.c +++ b/nuttx/arch/arm/src/sama5/sam_ehci.c @@ -3519,7 +3519,7 @@ static int sam_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) /* Free the container */ - kfree(epinfo); + kmm_free(epinfo); 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 * can be accessed more efficiently. This method provides a mechanism to * 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: * 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 */ - kfree(buffer); + kmm_free(buffer); return OK; } @@ -4177,7 +4177,7 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller) if (!g_qtdpool) { usbhost_trace1(EHCI_TRACE1_QTDPOOLALLOC_FAILED, 0); - kfree(g_qhpool); + kmm_free(g_qhpool); return NULL; } #endif @@ -4190,8 +4190,8 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller) if (!g_framelist) { usbhost_trace1(EHCI_TRACE1_PERFLALLOC_FAILED, 0); - kfree(g_qhpool); - kfree(g_qtdpool); + kmm_free(g_qhpool); + kmm_free(g_qtdpool); return NULL; } #endif diff --git a/nuttx/arch/arm/src/sama5/sam_emaca.c b/nuttx/arch/arm/src/sama5/sam_emaca.c index 50e1f1a49..f7df54fd6 100644 --- a/nuttx/arch/arm/src/sama5/sam_emaca.c +++ b/nuttx/arch/arm/src/sama5/sam_emaca.c @@ -662,25 +662,25 @@ static void sam_buffer_free(struct sam_emac_s *priv) if (priv->txdesc) { - kfree(priv->txdesc); + kmm_free(priv->txdesc); priv->txdesc = NULL; } if (priv->rxdesc) { - kfree(priv->rxdesc); + kmm_free(priv->rxdesc); priv->rxdesc = NULL; } if (priv->txbuffer) { - kfree(priv->txbuffer); + kmm_free(priv->txbuffer); priv->txbuffer = NULL; } if (priv->rxbuffer) { - kfree(priv->rxbuffer); + kmm_free(priv->rxbuffer); priv->rxbuffer = NULL; } #endif diff --git a/nuttx/arch/arm/src/sama5/sam_emacb.c b/nuttx/arch/arm/src/sama5/sam_emacb.c index 89024a7a8..b52144cef 100644 --- a/nuttx/arch/arm/src/sama5/sam_emacb.c +++ b/nuttx/arch/arm/src/sama5/sam_emacb.c @@ -989,25 +989,25 @@ static void sam_buffer_free(struct sam_emac_s *priv) if (priv->txdesc) { - kfree(priv->txdesc); + kmm_free(priv->txdesc); priv->txdesc = NULL; } if (priv->rxdesc) { - kfree(priv->rxdesc); + kmm_free(priv->rxdesc); priv->rxdesc = NULL; } if (priv->txbuffer) { - kfree(priv->txbuffer); + kmm_free(priv->txbuffer); priv->txbuffer = NULL; } if (priv->rxbuffer) { - kfree(priv->rxbuffer); + kmm_free(priv->rxbuffer); priv->rxbuffer = NULL; } #endif diff --git a/nuttx/arch/arm/src/sama5/sam_gmac.c b/nuttx/arch/arm/src/sama5/sam_gmac.c index 905b56ce4..fb18c8953 100644 --- a/nuttx/arch/arm/src/sama5/sam_gmac.c +++ b/nuttx/arch/arm/src/sama5/sam_gmac.c @@ -593,25 +593,25 @@ static void sam_buffer_free(struct sam_gmac_s *priv) if (priv->txdesc) { - kfree(priv->txdesc); + kmm_free(priv->txdesc); priv->txdesc = NULL; } if (priv->rxdesc) { - kfree(priv->rxdesc); + kmm_free(priv->rxdesc); priv->rxdesc = NULL; } if (priv->txbuffer) { - kfree(priv->txbuffer); + kmm_free(priv->txbuffer); priv->txbuffer = NULL; } if (priv->rxbuffer) { - kfree(priv->rxbuffer); + kmm_free(priv->rxbuffer); priv->rxbuffer = NULL; } #endif diff --git a/nuttx/arch/arm/src/sama5/sam_ohci.c b/nuttx/arch/arm/src/sama5/sam_ohci.c index 735d2c7b1..16c1c264d 100644 --- a/nuttx/arch/arm/src/sama5/sam_ohci.c +++ b/nuttx/arch/arm/src/sama5/sam_ohci.c @@ -2500,7 +2500,7 @@ errout_with_ed: sam_edfree(ed); errout_with_semaphore: sam_givesem(&g_ohci.exclsem); - kfree(eplist); + kmm_free(eplist); errout: return ret; } @@ -2577,7 +2577,7 @@ static int sam_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep) /* And free the container */ sem_destroy(&eplist->wdhsem); - kfree(eplist); + kmm_free(eplist); sam_givesem(&g_ohci.exclsem); 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 * can be accessed more efficiently. This method provides a mechanism to * 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: * drvr - The USB host driver instance obtained as a parameter from the call diff --git a/nuttx/arch/arm/src/sama5/sam_ssc.c b/nuttx/arch/arm/src/sama5/sam_ssc.c index ae9859648..cca63aad0 100644 --- a/nuttx/arch/arm/src/sama5/sam_ssc.c +++ b/nuttx/arch/arm/src/sama5/sam_ssc.c @@ -3524,7 +3524,7 @@ errout_with_clocking: errout_with_alloc: sem_destroy(&priv->exclsem); - kfree(priv); + kmm_free(priv); return NULL; } diff --git a/nuttx/arch/arm/src/sama5/sam_udphs.c b/nuttx/arch/arm/src/sama5/sam_udphs.c index afc38280c..5d2f1b24a 100644 --- a/nuttx/arch/arm/src/sama5/sam_udphs.c +++ b/nuttx/arch/arm/src/sama5/sam_udphs.c @@ -3508,7 +3508,7 @@ static void sam_ep_freereq(struct usbdev_ep_s *ep, struct usbdev_req_s *req) #endif usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog)); - kfree(privreq); + kmm_free(privreq); } /**************************************************************************** diff --git a/nuttx/arch/arm/src/stm32/stm32_i2c.c b/nuttx/arch/arm/src/stm32/stm32_i2c.c index fdbdcd874..b08dafd7a 100644 --- a/nuttx/arch/arm/src/stm32/stm32_i2c.c +++ b/nuttx/arch/arm/src/stm32/stm32_i2c.c @@ -1977,7 +1977,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev) if (--((struct stm32_i2c_inst_s *)dev)->priv->refs) { irqrestore(irqs); - kfree(dev); + kmm_free(dev); return OK; } @@ -1991,7 +1991,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev) stm32_i2c_sem_destroy((struct i2c_dev_s *)dev); - kfree(dev); + kmm_free(dev); return OK; } diff --git a/nuttx/arch/arm/src/stm32/stm32_i2c_alt.c b/nuttx/arch/arm/src/stm32/stm32_i2c_alt.c index c86b903b7..809d6d34a 100755 --- a/nuttx/arch/arm/src/stm32/stm32_i2c_alt.c +++ b/nuttx/arch/arm/src/stm32/stm32_i2c_alt.c @@ -2505,7 +2505,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev) if (--((struct stm32_i2c_inst_s *)dev)->priv->refs) { irqrestore(irqs); - kfree(dev); + kmm_free(dev); return OK; } @@ -2519,7 +2519,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev) stm32_i2c_sem_destroy((struct i2c_dev_s *)dev); - kfree(dev); + kmm_free(dev); return OK; } diff --git a/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c b/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c index 0ca931439..b5fe45e22 100644 --- a/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c +++ b/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c @@ -4269,7 +4269,7 @@ static void stm32_ep_freereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s #endif 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 usbdev_dma_free(buf); #else - kfree(buf); + kmm_free(buf); #endif } #endif diff --git a/nuttx/arch/arm/src/stm32/stm32_otgfshost.c b/nuttx/arch/arm/src/stm32/stm32_otgfshost.c index 7fe99c1c3..a60564780 100644 --- a/nuttx/arch/arm/src/stm32/stm32_otgfshost.c +++ b/nuttx/arch/arm/src/stm32/stm32_otgfshost.c @@ -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 * be accessed more efficiently. This method provides a mechanism to free that * 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: * 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 */ DEBUGASSERT(drvr && buffer); - kfree(buffer); + kmm_free(buffer); 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 * efficiently. This method provides a mechanism to free that IO buffer * 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: * 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 */ DEBUGASSERT(drvr && buffer); - kfree(buffer); + kmm_free(buffer); return OK; } diff --git a/nuttx/arch/arm/src/stm32/stm32_procfs_ccm.c b/nuttx/arch/arm/src/stm32/stm32_procfs_ccm.c index d025f9e5c..6918e3776 100644 --- a/nuttx/arch/arm/src/stm32/stm32_procfs_ccm.c +++ b/nuttx/arch/arm/src/stm32/stm32_procfs_ccm.c @@ -193,7 +193,7 @@ static int ccm_close(FAR struct file *filep) /* Release the file attributes structure */ - kfree(priv); + kmm_free(priv); filep->f_priv = NULL; return OK; } diff --git a/nuttx/arch/arm/src/stm32/stm32_usbdev.c b/nuttx/arch/arm/src/stm32/stm32_usbdev.c index 1231e5912..fbc83c5b9 100644 --- a/nuttx/arch/arm/src/stm32/stm32_usbdev.c +++ b/nuttx/arch/arm/src/stm32/stm32_usbdev.c @@ -3005,7 +3005,7 @@ static void stm32_epfreereq(struct usbdev_ep_s *ep, struct usbdev_req_s *req) #endif usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog)); - kfree(privreq); + kmm_free(privreq); } /**************************************************************************** diff --git a/nuttx/arch/arm/src/stm32/stm32f30xxx_i2c.c b/nuttx/arch/arm/src/stm32/stm32f30xxx_i2c.c index 747d0cbec..1a1f5b41b 100644 --- a/nuttx/arch/arm/src/stm32/stm32f30xxx_i2c.c +++ b/nuttx/arch/arm/src/stm32/stm32f30xxx_i2c.c @@ -2068,7 +2068,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev) if (--((struct stm32_i2c_inst_s *)dev)->priv->refs) { irqrestore(irqs); - kfree(dev); + kmm_free(dev); return OK; } @@ -2082,7 +2082,7 @@ int up_i2cuninitialize(FAR struct i2c_dev_s * dev) stm32_i2c_sem_destroy( (struct i2c_dev_s *)dev ); - kfree(dev); + kmm_free(dev); return OK; } diff --git a/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c b/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c index 57741250a..7e9e37555 100644 --- a/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c +++ b/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c @@ -2320,7 +2320,7 @@ static void avr_epfreereq(FAR struct usbdev_ep_s *ep, #endif 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 usbdev_dma_free(buf); #else - kfree(buf); + kmm_free(buf); #endif } #endif diff --git a/nuttx/arch/mips/src/pic32mx/pic32mx-usbdev.c b/nuttx/arch/mips/src/pic32mx/pic32mx-usbdev.c index c8f9326b6..7e9017901 100644 --- a/nuttx/arch/mips/src/pic32mx/pic32mx-usbdev.c +++ b/nuttx/arch/mips/src/pic32mx/pic32mx-usbdev.c @@ -3352,7 +3352,7 @@ static void pic32mx_epfreereq(struct usbdev_ep_s *ep, struct usbdev_req_s *req) #endif usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog)); - kfree(privreq); + kmm_free(privreq); } /**************************************************************************** diff --git a/nuttx/arch/rgmp/src/bridge.c b/nuttx/arch/rgmp/src/bridge.c index 640e73788..86992f143 100644 --- a/nuttx/arch/rgmp/src/bridge.c +++ b/nuttx/arch/rgmp/src/bridge.c @@ -125,7 +125,7 @@ int rtos_bridge_init(struct rgmp_bridge *b) return 0; err1: - kfree(bridge); + kmm_free(bridge); err0: return -1; } diff --git a/nuttx/arch/rgmp/src/nuttx.c b/nuttx/arch/rgmp/src/nuttx.c index b2c1bd3e2..234bb6dad 100644 --- a/nuttx/arch/rgmp/src/nuttx.c +++ b/nuttx/arch/rgmp/src/nuttx.c @@ -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 */ if (ttype == TCB_FLAG_TTYPE_KERNEL) { - kfree(dtcb->stack_alloc_ptr); + kmm_free(dtcb->stack_alloc_ptr); } else #endif { diff --git a/nuttx/arch/rgmp/src/rgmp.c b/nuttx/arch/rgmp/src/rgmp.c index 177e452c0..abe6c48ae 100644 --- a/nuttx/arch/rgmp/src/rgmp.c +++ b/nuttx/arch/rgmp/src/rgmp.c @@ -85,7 +85,7 @@ void *rtos_kmalloc(int size) void rtos_kfree(void *addr) { - kfree(addr); + kmm_free(addr); } /** diff --git a/nuttx/arch/rgmp/src/x86/com.c b/nuttx/arch/rgmp/src/x86/com.c index 99e970e3f..a4998f27b 100644 --- a/nuttx/arch/rgmp/src/x86/com.c +++ b/nuttx/arch/rgmp/src/x86/com.c @@ -202,7 +202,7 @@ static uart_dev_t *up_alloc_com(unsigned int base, int irq) return dev; err1: - kfree(priv); + kmm_free(priv); err0: 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) { - kfree(com->priv); - kfree(com); + kmm_free(com->priv); + kmm_free(com); } /**************************************************************************** diff --git a/nuttx/arch/sim/src/up_deviceimage.c b/nuttx/arch/sim/src/up_deviceimage.c index fc54e6676..6c541c3e1 100644 --- a/nuttx/arch/sim/src/up_deviceimage.c +++ b/nuttx/arch/sim/src/up_deviceimage.c @@ -59,8 +59,8 @@ #ifdef VFAT_STANDALONE # define sdbg(format, ...) printf(format, ##__VA_ARGS__) -# define kmalloc(size) malloc(size) -# define kfree(mem) free(mem) +# define kmm_malloc(size) malloc(size) +# define kmm_free(mem) free(mem) #endif /**************************************************************************** @@ -231,7 +231,7 @@ char *up_deviceimage(void) * 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 */ @@ -260,7 +260,7 @@ char *up_deviceimage(void) case Z_STREAM_ERROR: sdbg("inflate FAILED: ret=%d msg=\"%s\"\n", ret, strm.msg ? strm.msg : "No message" ); (void)inflateEnd(&strm); - kfree(pbuffer); + kmm_free(pbuffer); return NULL; } @@ -275,7 +275,7 @@ char *up_deviceimage(void) char *newbuffer = kmm_realloc(pbuffer, newbufsize); if (!newbuffer) { - kfree(pbuffer); + kmm_free(pbuffer); return NULL; } else @@ -295,7 +295,7 @@ char *up_deviceimage(void) char *newbuffer = kmm_realloc(pbuffer, newbufsize); if (!newbuffer) { - kfree(pbuffer); + kmm_free(pbuffer); return NULL; } else @@ -351,7 +351,7 @@ int main(int argc, char **argv, char **envp) if (deviceimage) { printf("Inflate SUCCEEDED\n"); - kfree(deviceimage); + kmm_free(deviceimage); return 0; } else diff --git a/nuttx/binfmt/binfmt_exec.c b/nuttx/binfmt/binfmt_exec.c index 71f8c9a85..b8680c004 100644 --- a/nuttx/binfmt/binfmt_exec.c +++ b/nuttx/binfmt/binfmt_exec.c @@ -124,7 +124,7 @@ int exec(FAR const char *filename, FAR char * const *argv, if (ret < 0) { bdbg("ERROR: Failed to load program '%s'\n", filename); - kfree(bin); + kmm_free(bin); 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); sched_unlock(); unload_module(bin); - kfree(bin); + kmm_free(bin); return ERROR; } diff --git a/nuttx/binfmt/binfmt_execmodule.c b/nuttx/binfmt/binfmt_execmodule.c index 34e8f30ac..a2bcd2e41 100644 --- a/nuttx/binfmt/binfmt_execmodule.c +++ b/nuttx/binfmt/binfmt_execmodule.c @@ -257,7 +257,7 @@ errout_with_stack: goto errout; errout_with_tcb: - kfree(tcb); + kmm_free(tcb); errout: set_errno(err); bdbg("returning errno: %d\n", err); diff --git a/nuttx/binfmt/binfmt_exepath.c b/nuttx/binfmt/binfmt_exepath.c index 5da242b4c..af69499d1 100644 --- a/nuttx/binfmt/binfmt_exepath.c +++ b/nuttx/binfmt/binfmt_exepath.c @@ -161,7 +161,7 @@ EXEPATH_HANDLE exepath_init(void) * is marked executable). * * 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 * '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. */ - kfree(fullpath); + kmm_free(fullpath); } /* 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) { - kfree(handle); + kmm_free(handle); } #endif /* !CONFIG_BINFMT_DISABLE && CONFIG_BINFMT_EXEPATH */ diff --git a/nuttx/binfmt/binfmt_loadmodule.c b/nuttx/binfmt/binfmt_loadmodule.c index 5ff7f7535..636c537d9 100644 --- a/nuttx/binfmt/binfmt_loadmodule.c +++ b/nuttx/binfmt/binfmt_loadmodule.c @@ -226,7 +226,7 @@ int load_module(FAR struct binary_s *bin) /* Free the allocated fullpath */ - kfree(fullpath); + kmm_free(fullpath); /* Break out of the loop with ret == OK on success */ diff --git a/nuttx/binfmt/binfmt_schedunload.c b/nuttx/binfmt/binfmt_schedunload.c index a3f6f9cc1..cedd940c6 100644 --- a/nuttx/binfmt/binfmt_schedunload.c +++ b/nuttx/binfmt/binfmt_schedunload.c @@ -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 * automatically unload the module when task exits. It assumes that * 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: * 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 */ - 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 * 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() - * 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. * * Input Parameter: diff --git a/nuttx/binfmt/libelf/libelf_uninit.c b/nuttx/binfmt/libelf/libelf_uninit.c index 3ec6f6c61..fb673e739 100644 --- a/nuttx/binfmt/libelf/libelf_uninit.c +++ b/nuttx/binfmt/libelf/libelf_uninit.c @@ -111,13 +111,13 @@ int elf_freebuffers(struct elf_loadinfo_s *loadinfo) if (loadinfo->shdr) { - kfree((FAR void *)loadinfo->shdr); + kmm_free((FAR void *)loadinfo->shdr); loadinfo->shdr = NULL; } if (loadinfo->iobuffer) { - kfree((FAR void *)loadinfo->iobuffer); + kmm_free((FAR void *)loadinfo->iobuffer); loadinfo->iobuffer = NULL; loadinfo->buflen = 0; } diff --git a/nuttx/binfmt/libnxflat/libnxflat_addrenv.c b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c index d5abc452d..7378c2438 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_addrenv.c +++ b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c @@ -157,7 +157,7 @@ errout_with_addrenv: loadinfo->addrenv = 0; errout_with_dspace: - kfree(dspace); + kmm_free(dspace); return ret; #else /* Allocate (and zero) memory to hold the ELF image */ @@ -165,7 +165,7 @@ errout_with_dspace: dspace->region = (FAR uint8_t *)kumm_zalloc(envsize); if (!dspace->region) { - kfree(dspace); + kmm_free(dspace); return -ENOMEM; } @@ -227,7 +227,7 @@ void nxflat_addrenv_free(FAR struct nxflat_loadinfo_s *loadinfo) /* Now destroy the D-Space container */ DEBUGASSERT(dspace->crefs == 1); - kfree(dspace); + kmm_free(dspace); loadinfo->dspace = NULL; } } diff --git a/nuttx/binfmt/pcode.c b/nuttx/binfmt/pcode.c index b2a243cb0..b2cac5880 100644 --- a/nuttx/binfmt/pcode.c +++ b/nuttx/binfmt/pcode.c @@ -267,7 +267,7 @@ static int pcode_proxy(int argc, char **argv) if (ret < 0) { bdbg("ERROR: on_exit failed: %d\n", get_errno()); - kfree(fullpath); + kmm_free(fullpath); return EXIT_FAILURE; } @@ -277,7 +277,7 @@ static int pcode_proxy(int argc, char **argv) /* We no longer need the fullpath */ - kfree(fullpath); + kmm_free(fullpath); /* Check the result of the interpretation */ diff --git a/nuttx/configs/ea3131/src/up_usbmsc.c b/nuttx/configs/ea3131/src/up_usbmsc.c index 67e9d5afe..9a7e74427 100644 --- a/nuttx/configs/ea3131/src/up_usbmsc.c +++ b/nuttx/configs/ea3131/src/up_usbmsc.c @@ -108,7 +108,7 @@ int usbmsc_archinitialize(void) { printf("create_ramdisk: Failed to register ramdisk at %s: %d\n", g_source, -ret); - kfree(pbuffer); + kmm_free(pbuffer); return ret; } @@ -119,7 +119,7 @@ int usbmsc_archinitialize(void) { printf("create_ramdisk: Failed to create FAT filesystem on ramdisk at %s\n", g_source); - /* kfree(pbuffer); -- RAM disk is registered */ + /* kmm_free(pbuffer); -- RAM disk is registered */ return ret; } diff --git a/nuttx/configs/ea3152/src/up_usbmsc.c b/nuttx/configs/ea3152/src/up_usbmsc.c index e861ad48f..44d11089d 100644 --- a/nuttx/configs/ea3152/src/up_usbmsc.c +++ b/nuttx/configs/ea3152/src/up_usbmsc.c @@ -108,7 +108,7 @@ int usbmsc_archinitialize(void) { printf("create_ramdisk: Failed to register ramdisk at %s: %d\n", g_source, -ret); - kfree(pbuffer); + kmm_free(pbuffer); return ret; } @@ -119,7 +119,7 @@ int usbmsc_archinitialize(void) { printf("create_ramdisk: Failed to create FAT filesystem on ramdisk at %s\n", g_source); - /* kfree(pbuffer); -- RAM disk is registered */ + /* kmm_free(pbuffer); -- RAM disk is registered */ return ret; } diff --git a/nuttx/configs/mikroe-stm32f4/src/up_touchscreen.c b/nuttx/configs/mikroe-stm32f4/src/up_touchscreen.c index 52edd65de..ab18f05d5 100644 --- a/nuttx/configs/mikroe-stm32f4/src/up_touchscreen.c +++ b/nuttx/configs/mikroe-stm32f4/src/up_touchscreen.c @@ -1578,7 +1578,7 @@ int arch_tcinitialize(int minor) errout_with_priv: sem_destroy(&priv->devsem); #ifdef CONFIG_TOUCHSCREEN_MULTIPLE - kfree(priv); + kmm_free(priv); #endif return ret; } diff --git a/nuttx/configs/pic32mx7mmb/src/up_touchscreen.c b/nuttx/configs/pic32mx7mmb/src/up_touchscreen.c index 99b35151c..fd048d613 100644 --- a/nuttx/configs/pic32mx7mmb/src/up_touchscreen.c +++ b/nuttx/configs/pic32mx7mmb/src/up_touchscreen.c @@ -1431,7 +1431,7 @@ int arch_tcinitialize(int minor) errout_with_priv: sem_destroy(&priv->devsem); #ifdef CONFIG_TOUCHSCREEN_MULTIPLE - kfree(priv); + kmm_free(priv); #endif return ret; } diff --git a/nuttx/crypto/testmngr.c b/nuttx/crypto/testmngr.c index d307599d0..464f0fdc0 100644 --- a/nuttx/crypto/testmngr.c +++ b/nuttx/crypto/testmngr.c @@ -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); } - kfree(out); + kmm_free(out); return res; } diff --git a/nuttx/drivers/audio/i2schar.c b/nuttx/drivers/audio/i2schar.c index 3bb0d2376..a7a86e90f 100644 --- a/nuttx/drivers/audio/i2schar.c +++ b/nuttx/drivers/audio/i2schar.c @@ -431,7 +431,7 @@ int i2schar_register(FAR struct i2s_dev_s *i2s, int minor) * device. */ - kfree(priv); + kmm_free(priv); } /* Return the result of the registration */ diff --git a/nuttx/drivers/audio/vs1053.c b/nuttx/drivers/audio/vs1053.c index 102fa4e65..c1853be43 100644 --- a/nuttx/drivers/audio/vs1053.c +++ b/nuttx/drivers/audio/vs1053.c @@ -1890,7 +1890,7 @@ struct audio_lowerhalf_s *vs1053_initialize(FAR struct spi_dev_s *spi, if (id != VS1053_VER_VS1053) { auddbg("Unexpected VER bits: 0x%0X\n", id); - kfree(dev); + kmm_free(dev); return NULL; } else diff --git a/nuttx/drivers/audio/wm8904.c b/nuttx/drivers/audio/wm8904.c index 4103c447b..c9e32548f 100644 --- a/nuttx/drivers/audio/wm8904.c +++ b/nuttx/drivers/audio/wm8904.c @@ -2518,6 +2518,6 @@ FAR struct audio_lowerhalf_s * errout_with_dev: sem_destroy(&priv->pendsem); - kfree(priv); + kmm_free(priv); return NULL; } diff --git a/nuttx/drivers/bch/bchlib_setup.c b/nuttx/drivers/bch/bchlib_setup.c index 1026248b5..7b2155158 100644 --- a/nuttx/drivers/bch/bchlib_setup.c +++ b/nuttx/drivers/bch/bchlib_setup.c @@ -154,6 +154,6 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle) return OK; errout_with_bch: - kfree(bch); + kmm_free(bch); return ret; } diff --git a/nuttx/drivers/bch/bchlib_teardown.c b/nuttx/drivers/bch/bchlib_teardown.c index 8657c4a69..8d1f45ed9 100644 --- a/nuttx/drivers/bch/bchlib_teardown.c +++ b/nuttx/drivers/bch/bchlib_teardown.c @@ -103,11 +103,11 @@ int bchlib_teardown(FAR void *handle) if (bch->buffer) { - kfree(bch->buffer); + kmm_free(bch->buffer); } sem_destroy(&bch->sem); - kfree(bch); + kmm_free(bch); return OK; } diff --git a/nuttx/drivers/input/ads7843e.c b/nuttx/drivers/input/ads7843e.c index aba8bb323..ee2f6122d 100644 --- a/nuttx/drivers/input/ads7843e.c +++ b/nuttx/drivers/input/ads7843e.c @@ -1306,7 +1306,7 @@ int ads7843e_register(FAR struct spi_dev_s *spi, errout_with_priv: sem_destroy(&priv->devsem); #ifdef CONFIG_ADS7843E_MULTIPLE - kfree(priv); + kmm_free(priv); #endif return ret; } diff --git a/nuttx/drivers/input/max11802.c b/nuttx/drivers/input/max11802.c index 5b50281ef..ff889e1a1 100644 --- a/nuttx/drivers/input/max11802.c +++ b/nuttx/drivers/input/max11802.c @@ -1315,7 +1315,7 @@ int max11802_register(FAR struct spi_dev_s *spi, errout_with_priv: sem_destroy(&priv->devsem); #ifdef CONFIG_MAX11802_MULTIPLE - kfree(priv); + kmm_free(priv); #endif return ret; } diff --git a/nuttx/drivers/input/mxt.c b/nuttx/drivers/input/mxt.c index ec97f0864..5fba84d99 100644 --- a/nuttx/drivers/input/mxt.c +++ b/nuttx/drivers/input/mxt.c @@ -1819,7 +1819,7 @@ static int mxt_hwinitialize(FAR struct mxt_dev_s *priv) /* Error exits */ errout_with_objtab: - kfree(priv->objtab); + kmm_free(priv->objtab); priv->objtab = NULL; return ret; @@ -1923,13 +1923,13 @@ int mxt_register(FAR struct i2c_dev_s *i2c, /* Error clean-up exits */ errout_with_hwinit: - kfree(priv->objtab); - kfree(priv->sample); + kmm_free(priv->objtab); + kmm_free(priv->sample); errout_with_irq: MXT_DETACH(lower); errout_with_priv: sem_destroy(&priv->devsem); sem_destroy(&priv->waitsem); - kfree(priv); + kmm_free(priv); return ret; } diff --git a/nuttx/drivers/input/stmpe811_base.c b/nuttx/drivers/input/stmpe811_base.c index 093ff39ae..e651f40e8 100644 --- a/nuttx/drivers/input/stmpe811_base.c +++ b/nuttx/drivers/input/stmpe811_base.c @@ -339,7 +339,7 @@ STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_dev_s *dev, if (ret < 0) { #ifdef CONFIG_STMPE811_MULTIPLE - kfree(priv); + kmm_free(priv); #endif return NULL; } diff --git a/nuttx/drivers/input/tsc2007.c b/nuttx/drivers/input/tsc2007.c index 89bad68ba..9385e28e0 100644 --- a/nuttx/drivers/input/tsc2007.c +++ b/nuttx/drivers/input/tsc2007.c @@ -1330,7 +1330,7 @@ int tsc2007_register(FAR struct i2c_dev_s *dev, errout_with_priv: sem_destroy(&priv->devsem); #ifdef CONFIG_TSC2007_MULTIPLE - kfree(priv); + kmm_free(priv); #endif return ret; } diff --git a/nuttx/drivers/loop.c b/nuttx/drivers/loop.c index d520e7149..f149f38cd 100644 --- a/nuttx/drivers/loop.c +++ b/nuttx/drivers/loop.c @@ -441,7 +441,7 @@ int losetup(const char *devname, const char *filename, uint16_t sectsize, errout_with_fd: close(dev->fd); errout_with_dev: - kfree(dev); + kmm_free(dev); return ret; } @@ -504,6 +504,6 @@ int loteardown(const char *devname) (void)close(dev->fd); } - kfree(dev); + kmm_free(dev); return ret; } diff --git a/nuttx/drivers/mmcsd/mmcsd_sdio.c b/nuttx/drivers/mmcsd/mmcsd_sdio.c index 2e35c9a81..113ba7101 100644 --- a/nuttx/drivers/mmcsd/mmcsd_sdio.c +++ b/nuttx/drivers/mmcsd/mmcsd_sdio.c @@ -3190,7 +3190,7 @@ static void mmcsd_hwuninitialize(FAR struct mmcsd_state_s *priv) { mmcsd_removed(priv); SDIO_RESET(priv->dev); - kfree(priv); + kmm_free(priv); } } @@ -3311,7 +3311,7 @@ errout_with_hwinit: return ret; errout_with_alloc: - kfree(priv); + kmm_free(priv); return ret; } diff --git a/nuttx/drivers/mtd/at25.c b/nuttx/drivers/mtd/at25.c index 0c3a5606e..08517f701 100644 --- a/nuttx/drivers/mtd/at25.c +++ b/nuttx/drivers/mtd/at25.c @@ -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 */ fdbg("ERROR: Unrecognized\n"); - kfree(priv); + kmm_free(priv); priv = NULL; } else diff --git a/nuttx/drivers/mtd/at45db.c b/nuttx/drivers/mtd/at45db.c index 4ca57ffcf..25ca42417 100644 --- a/nuttx/drivers/mtd/at45db.c +++ b/nuttx/drivers/mtd/at45db.c @@ -902,6 +902,6 @@ FAR struct mtd_dev_s *at45db_initialize(FAR struct spi_dev_s *spi) errout: at45db_unlock(priv); - kfree(priv); + kmm_free(priv); return NULL; } diff --git a/nuttx/drivers/mtd/ftl.c b/nuttx/drivers/mtd/ftl.c index 837928fd4..457967d1b 100644 --- a/nuttx/drivers/mtd/ftl.c +++ b/nuttx/drivers/mtd/ftl.c @@ -539,7 +539,7 @@ int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd) if (ret < 0) { fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret); - kfree(dev); + kmm_free(dev); return ret; } @@ -550,7 +550,7 @@ int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd) if (!dev->eblock) { fdbg("Failed to allocate an erase block buffer\n"); - kfree(dev); + kmm_free(dev); return -ENOMEM; } #endif @@ -581,7 +581,7 @@ int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd) if (ret < 0) { fdbg("rwb_initialize failed: %d\n", ret); - kfree(dev); + kmm_free(dev); return ret; } #endif @@ -596,7 +596,7 @@ int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd) if (ret < 0) { fdbg("register_blockdriver failed: %d\n", -ret); - kfree(dev); + kmm_free(dev); } } return ret; diff --git a/nuttx/drivers/mtd/m25px.c b/nuttx/drivers/mtd/m25px.c index 3e241c13a..ce6d1e1e0 100644 --- a/nuttx/drivers/mtd/m25px.c +++ b/nuttx/drivers/mtd/m25px.c @@ -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 */ fdbg("Unrecognized\n"); - kfree(priv); + kmm_free(priv); priv = NULL; } } diff --git a/nuttx/drivers/mtd/mtd_config.c b/nuttx/drivers/mtd/mtd_config.c index 19b309ac4..3e71f2a0a 100644 --- a/nuttx/drivers/mtd/mtd_config.c +++ b/nuttx/drivers/mtd/mtd_config.c @@ -688,7 +688,7 @@ static off_t mtdconfig_ramconsolidate(FAR struct mtdconfig_struct_s *dev) } errout: - kfree(pBuf); + kmm_free(pBuf); return dst_offset; } @@ -894,7 +894,7 @@ retry_relocate: } errout: - kfree(pBuf); + kmm_free(pBuf); return 0; } #endif /* CONFIG_MTD_CONFIG_RAM_CONSOLIDATE */ @@ -1203,7 +1203,7 @@ errout: /* Free the buffer */ - kfree(dev->buffer); + kmm_free(dev->buffer); return ret; } @@ -1263,7 +1263,7 @@ static int mtdconfig_getconfig(FAR struct mtdconfig_struct_s *dev, errout: /* Free the buffer */ - kfree(dev->buffer); + kmm_free(dev->buffer); return ret; } @@ -1356,7 +1356,7 @@ int mtdconfig_register(FAR struct mtd_dev_s *mtd) if (ret < 0) { fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret); - kfree(dev); + kmm_free(dev); goto errout; } diff --git a/nuttx/drivers/mtd/mtd_partition.c b/nuttx/drivers/mtd/mtd_partition.c index 1196ea355..e753cc055 100644 --- a/nuttx/drivers/mtd/mtd_partition.c +++ b/nuttx/drivers/mtd/mtd_partition.c @@ -527,7 +527,7 @@ static int part_procfs_close(FAR struct file *filep) /* Release the file attributes structure */ - kfree(attr); + kmm_free(attr); filep->f_priv = NULL; return OK; } diff --git a/nuttx/drivers/mtd/mtd_procfs.c b/nuttx/drivers/mtd/mtd_procfs.c index 54366789b..05f17abef 100644 --- a/nuttx/drivers/mtd/mtd_procfs.c +++ b/nuttx/drivers/mtd/mtd_procfs.c @@ -186,7 +186,7 @@ static int mtd_close(FAR struct file *filep) /* Release the file attributes structure */ - kfree(attr); + kmm_free(attr); filep->f_priv = NULL; return OK; } diff --git a/nuttx/drivers/mtd/mtd_rwbuffer.c b/nuttx/drivers/mtd/mtd_rwbuffer.c index 0f6e549e6..d0cd21dfb 100644 --- a/nuttx/drivers/mtd/mtd_rwbuffer.c +++ b/nuttx/drivers/mtd/mtd_rwbuffer.c @@ -405,7 +405,7 @@ FAR struct mtd_dev_s *mtd_rwb_initialize(FAR struct mtd_dev_s *mtd) if (ret < 0) { fdbg("ERROR: rwb_initialize failed: %d\n", ret); - kfree(priv); + kmm_free(priv); return NULL; } } diff --git a/nuttx/drivers/mtd/ramtron.c b/nuttx/drivers/mtd/ramtron.c index 8bf2192f5..285dc2dad 100644 --- a/nuttx/drivers/mtd/ramtron.c +++ b/nuttx/drivers/mtd/ramtron.c @@ -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 */ - kfree(priv); + kmm_free(priv); priv = NULL; } } diff --git a/nuttx/drivers/mtd/sector512.c b/nuttx/drivers/mtd/sector512.c index b29942f5f..7438700c8 100644 --- a/nuttx/drivers/mtd/sector512.c +++ b/nuttx/drivers/mtd/sector512.c @@ -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 */ fdbg("Allocation failed\n"); - kfree(priv); + kmm_free(priv); priv = NULL; } } diff --git a/nuttx/drivers/mtd/smart.c b/nuttx/drivers/mtd/smart.c index 0065bdd71..860708f5b 100644 --- a/nuttx/drivers/mtd/smart.c +++ b/nuttx/drivers/mtd/smart.c @@ -502,12 +502,12 @@ static int smart_setsectorsize(struct smart_struct_s *dev, uint16_t size) if (dev->sMap != NULL) { - kfree(dev->sMap); + kmm_free(dev->sMap); } if (dev->rwbuffer != NULL) { - kfree(dev->rwbuffer); + kmm_free(dev->rwbuffer); } /* 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) { fdbg("Error allocating SMART virtual map buffer\n"); - kfree(dev); + kmm_free(dev); return -EINVAL; } @@ -535,8 +535,8 @@ static int smart_setsectorsize(struct smart_struct_s *dev, uint16_t size) if (!dev->rwbuffer) { fdbg("Error allocating SMART read/write buffer\n"); - kfree(dev->sMap); - kfree(dev); + kmm_free(dev->sMap); + kmm_free(dev); return -EINVAL; } @@ -2131,7 +2131,7 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, const char *partname) if (ret < 0) { fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret); - kfree(dev); + kmm_free(dev); 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); if (ret != OK) { - kfree(dev); + kmm_free(dev); goto errout; } @@ -2152,7 +2152,7 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, const char *partname) if (totalsectors > 65534) { fdbg("SMART Sector size too small for device\n"); - kfree(dev); + kmm_free(dev); ret = -EINVAL; goto errout; } @@ -2196,9 +2196,9 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, const char *partname) if (rootdirdev == NULL) { fdbg("register_blockdriver failed: %d\n", -ret); - kfree(dev->sMap); - kfree(dev->rwbuffer); - kfree(dev); + kmm_free(dev->sMap); + kmm_free(dev->rwbuffer); + kmm_free(dev); ret = -ENOMEM; goto errout; } @@ -2227,9 +2227,9 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, const char *partname) if (ret < 0) { fdbg("register_blockdriver failed: %d\n", -ret); - kfree(dev->sMap); - kfree(dev->rwbuffer); - kfree(dev); + kmm_free(dev->sMap); + kmm_free(dev->rwbuffer); + kmm_free(dev); goto errout; } diff --git a/nuttx/drivers/mtd/sst25.c b/nuttx/drivers/mtd/sst25.c index b80f8f479..25622c5ef 100644 --- a/nuttx/drivers/mtd/sst25.c +++ b/nuttx/drivers/mtd/sst25.c @@ -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 */ fdbg("Unrecognized\n"); - kfree(priv); + kmm_free(priv); priv = NULL; } 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 */ fdbg("Allocation failed\n"); - kfree(priv); + kmm_free(priv); priv = NULL; } #endif diff --git a/nuttx/drivers/mtd/sst25xx.c b/nuttx/drivers/mtd/sst25xx.c index 1163ed8d2..f6bcb53a7 100644 --- a/nuttx/drivers/mtd/sst25xx.c +++ b/nuttx/drivers/mtd/sst25xx.c @@ -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 */ fdbg("Unrecognized\n"); - kfree(priv); + kmm_free(priv); priv = NULL; } else diff --git a/nuttx/drivers/mtd/w25.c b/nuttx/drivers/mtd/w25.c index 0555450c5..f56632e6e 100644 --- a/nuttx/drivers/mtd/w25.c +++ b/nuttx/drivers/mtd/w25.c @@ -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 */ fdbg("Unrecognized\n"); - kfree(priv); + kmm_free(priv); priv = NULL; } 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 */ fdbg("Allocation failed\n"); - kfree(priv); + kmm_free(priv); priv = NULL; } #endif diff --git a/nuttx/drivers/net/e1000.c b/nuttx/drivers/net/e1000.c index d109f0d4f..cce575082 100644 --- a/nuttx/drivers/net/e1000.c +++ b/nuttx/drivers/net/e1000.c @@ -1119,7 +1119,7 @@ err1: err0: rgmp_memunmap(mmio_base, mmio_size); error: - kfree(dev); + kmm_free(dev); cprintf("e1000 device probe fail: %d\n", err); return err; } @@ -1154,7 +1154,7 @@ void e1000_mod_exit(void) free(dev->tx_ring.desc); pci_free_irq(dev->pci_addr); rgmp_memunmap((uintptr_t)dev->io_mem_base, dev->mem_size); - kfree(dev); + kmm_free(dev); } e1000_list.next = NULL; diff --git a/nuttx/drivers/pipes/pipe_common.c b/nuttx/drivers/pipes/pipe_common.c index be285464d..aad49eff0 100644 --- a/nuttx/drivers/pipes/pipe_common.c +++ b/nuttx/drivers/pipes/pipe_common.c @@ -174,7 +174,7 @@ void pipecommon_freedev(FAR struct pipe_dev_s *dev) sem_destroy(&dev->d_bfsem); sem_destroy(&dev->d_rdsem); 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 */ - kfree(dev->d_buffer); + kmm_free(dev->d_buffer); dev->d_buffer = NULL; /* And reset all counts and indices */ diff --git a/nuttx/drivers/power/max1704x.c b/nuttx/drivers/power/max1704x.c index db0750e6d..e44cb1079 100644 --- a/nuttx/drivers/power/max1704x.c +++ b/nuttx/drivers/power/max1704x.c @@ -553,7 +553,7 @@ FAR struct battery_dev_s *max1704x_initialize(FAR struct i2c_dev_s *i2c, if (ret < 0) { batdbg("Failed to reset the MAX1704x: %d\n", ret); - kfree(priv); + kmm_free(priv); return NULL; } #endif diff --git a/nuttx/drivers/ramdisk.c b/nuttx/drivers/ramdisk.c index 8b7a0a1f6..0ada5c0cf 100644 --- a/nuttx/drivers/ramdisk.c +++ b/nuttx/drivers/ramdisk.c @@ -335,7 +335,7 @@ int romdisk_register(int minor, uint8_t *buffer, uint32_t nsectors, if (ret < 0) { fdbg("register_blockdriver failed: %d\n", -ret); - kfree(dev); + kmm_free(dev); } } diff --git a/nuttx/drivers/rwbuffer.c b/nuttx/drivers/rwbuffer.c index f8c378565..e02dcf6f8 100644 --- a/nuttx/drivers/rwbuffer.c +++ b/nuttx/drivers/rwbuffer.c @@ -713,7 +713,7 @@ void rwb_uninitialize(FAR struct rwbuffer_s *rwb) sem_destroy(&rwb->wrsem); if (rwb->wrbuffer) { - kfree(rwb->wrbuffer); + kmm_free(rwb->wrbuffer); } } #endif @@ -724,7 +724,7 @@ void rwb_uninitialize(FAR struct rwbuffer_s *rwb) sem_destroy(&rwb->rhsem); if (rwb->rhbuffer) { - kfree(rwb->rhbuffer); + kmm_free(rwb->rhbuffer); } } #endif diff --git a/nuttx/drivers/sensors/lis331dl.c b/nuttx/drivers/sensors/lis331dl.c index 0760a59cd..12ff46f6c 100644 --- a/nuttx/drivers/sensors/lis331dl.c +++ b/nuttx/drivers/sensors/lis331dl.c @@ -270,7 +270,7 @@ FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_dev_s *i2c, /* Error exit */ - kfree(dev); + kmm_free(dev); errno = retval; return NULL; } @@ -280,7 +280,7 @@ int lis331dl_deinit(FAR struct lis331dl_dev_s * dev) ASSERT(dev); lis331dl_powerdown(dev); - kfree(dev); + kmm_free(dev); return OK; } diff --git a/nuttx/drivers/sensors/lm75.c b/nuttx/drivers/sensors/lm75.c index 2884f29c6..89f8b0885 100644 --- a/nuttx/drivers/sensors/lm75.c +++ b/nuttx/drivers/sensors/lm75.c @@ -531,7 +531,7 @@ 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); - kfree(priv); + kmm_free(priv); } return ret; diff --git a/nuttx/drivers/syslog/ramlog.c b/nuttx/drivers/syslog/ramlog.c index 4075590f2..7ad2602ee 100644 --- a/nuttx/drivers/syslog/ramlog.c +++ b/nuttx/drivers/syslog/ramlog.c @@ -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); if (ret < 0) { - kfree(priv); + kmm_free(priv); } } diff --git a/nuttx/drivers/timer.c b/nuttx/drivers/timer.c index d8dd6b01f..db0f333da 100644 --- a/nuttx/drivers/timer.c +++ b/nuttx/drivers/timer.c @@ -516,11 +516,11 @@ FAR void *timer_register(FAR const char *path, return (FAR void *)upper; errout_with_path: - kfree(upper->path); + kmm_free(upper->path); errout_with_upper: //sem_destroy(&upper->exclsem); - kfree(upper); + kmm_free(upper); errout: return NULL; @@ -565,9 +565,9 @@ void timer_unregister(FAR void *handle) /* Then free all of the driver resources */ - kfree(upper->path); + kmm_free(upper->path); //sem_destroy(&upper->exclsem); - kfree(upper); + kmm_free(upper); } #endif /* CONFIG_TIMER */ diff --git a/nuttx/drivers/usbdev/cdcacm.c b/nuttx/drivers/usbdev/cdcacm.c index 91d105226..2de32b3cf 100644 --- a/nuttx/drivers/usbdev/cdcacm.c +++ b/nuttx/drivers/usbdev/cdcacm.c @@ -2310,7 +2310,7 @@ int cdcacm_classobject(int minor, FAR struct usbdevclass_driver_s **classdev) return OK; errout_with_class: - kfree(alloc); + kmm_free(alloc); return ret; } @@ -2415,7 +2415,7 @@ void cdcacm_uninitialize(FAR void *handle) * free the memory resources. */ - kfree(priv); + kmm_free(priv); return; } #endif @@ -2445,7 +2445,7 @@ void cdcacm_uninitialize(FAR void *handle) /* And free the driver structure */ - kfree(priv); + kmm_free(priv); #else /* For the case of the composite driver, there is a two pass diff --git a/nuttx/drivers/usbdev/composite.c b/nuttx/drivers/usbdev/composite.c index 27cbcff9c..9c7ca5208 100644 --- a/nuttx/drivers/usbdev/composite.c +++ b/nuttx/drivers/usbdev/composite.c @@ -851,7 +851,7 @@ FAR void *composite_initialize(void) return (FAR void *)alloc; errout_with_alloc: - kfree(alloc); + kmm_free(alloc); return NULL; } @@ -901,7 +901,7 @@ void composite_uninitialize(FAR void *handle) /* Then free the composite driver state structure itself */ - kfree(priv); + kmm_free(priv); } /**************************************************************************** diff --git a/nuttx/drivers/usbdev/pl2303.c b/nuttx/drivers/usbdev/pl2303.c index 102160725..45c92880c 100644 --- a/nuttx/drivers/usbdev/pl2303.c +++ b/nuttx/drivers/usbdev/pl2303.c @@ -2368,6 +2368,6 @@ int usbdev_serialinitialize(int minor) errout_with_class: usbdev_unregister(&drvr->drvr); errout_with_alloc: - kfree(alloc); + kmm_free(alloc); return ret; } diff --git a/nuttx/drivers/usbdev/usbmsc.c b/nuttx/drivers/usbdev/usbmsc.c index 6ff18ef5b..6332f5de7 100644 --- a/nuttx/drivers/usbdev/usbmsc.c +++ b/nuttx/drivers/usbdev/usbmsc.c @@ -1771,7 +1771,7 @@ void usbmsc_uninitialize(FAR void *handle) * free the memory resources. */ - kfree(priv); + kmm_free(priv); return; } #endif @@ -1818,13 +1818,13 @@ void usbmsc_uninitialize(FAR void *handle) usbmsc_lununinitialize(&priv->luntab[i]); } - kfree(priv->luntab); + kmm_free(priv->luntab); /* Release the I/O buffer */ if (priv->iobuffer) { - kfree(priv->iobuffer); + kmm_free(priv->iobuffer); } /* Uninitialize and release the driver structure */ @@ -1840,6 +1840,6 @@ void usbmsc_uninitialize(FAR void *handle) * second pass because of priv->thpid == 0) */ - kfree(priv); + kmm_free(priv); #endif } diff --git a/nuttx/drivers/usbhost/usbhost_devaddr.c b/nuttx/drivers/usbhost/usbhost_devaddr.c index 95523f78e..e4bd67922 100755 --- a/nuttx/drivers/usbhost/usbhost_devaddr.c +++ b/nuttx/drivers/usbhost/usbhost_devaddr.c @@ -1,333 +1,333 @@ -/*******************************************************************************
- * drivers/usbhost/usbhost_devaddr.c
- * Manage USB device addresses
- *
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
- * Authors: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- *******************************************************************************/
-
-/*******************************************************************************
- * Included Files
- *******************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-#include <errno.h>
-#include <debug.h>
-
-#include <nuttx/kmalloc.h>
-#include <nuttx/usb/usbhost_devaddr.h>
-
-/*******************************************************************************
- * Pre-processor Definitions
- *******************************************************************************/
-
-/*******************************************************************************
- * Private Functions
- *******************************************************************************/
-
-/****************************************************************************
- * Name: usbhost_takesem and usbhost_givesem
- *
- * Description:
- * This is just a wrapper to handle the annoying behavior of semaphore
- * waits that return due to the receipt of a signal.
- *
- *******************************************************************************/
-
-static void usbhost_takesem(FAR struct usbhost_devaddr_s *hcd)
-{
- /* Take the semaphore (perhaps waiting) */
-
- while (sem_wait(&hcd->exclsem) != 0)
- {
- /* The only case that an error should occr here is if the wait was
- * awakened by a signal.
- */
-
- ASSERT(errno == EINTR);
- }
-}
-
-#define usbhost_givesem(hcd) sem_post(&hcd->exclsem)
-
-/*******************************************************************************
- * Name: usbhost_devaddr_hash
- *
- * Description:
- * Create a hash value from a device address.
- *
- *******************************************************************************/
-
-static inline uint8_t usbhost_devaddr_hash(uint8_t devaddr)
-{
- uint8_t ret = devaddr;
-
- ret ^= (devaddr >> 2);
- ret ^= (devaddr >> 3);
- return ret & USBHOST_DEVADDR_HASHMASK;
-}
-
-/*******************************************************************************
- * Name: usbhost_devaddr_allocate
- *
- * Description:
- * Allocate a new unique device address for this HCD.
- *
- * Assumptions:
- * Caller hold the exclsem
- *
- *******************************************************************************/
-
-static int usbhost_devaddr_allocate(FAR struct usbhost_devaddr_s *hcd)
-{
- uint8_t startaddr = hcd->next;
- uint8_t devaddr;
- int index;
- int bitno;
-
- /* Loop until we find a valid device address */
-
- for (;;)
- {
- /* Try the next device address */
-
- devaddr = hcd->next;
- if (hcd->next >= 0x7f)
- {
- hcd->next = 1;
- }
- else
- {
- hcd->next++;
- }
-
- /* Is this address already allocated? */
-
- index = devaddr >> 5;
- bitno = devaddr & 0x1f;
- if ((hcd->alloctab[index] & (1 << bitno)) == 0)
- {
- /* No... allocate it now */
-
- hcd->alloctab[index] |= (1 << bitno);
- return (int)devaddr;
- }
-
- /* This address has already been allocated. The followign logic will
- * prevent (unexpected) infinite loops.
- */
-
- if (startaddr == devaddr)
- {
- /* We are back where we started... the are no free device address */
-
- return -ENOMEM;
- }
- }
-}
-
-/*******************************************************************************
- * Public Functions
- *******************************************************************************/
-
-/*******************************************************************************
- * Name: usbhost_devaddr_initialize
- *
- * Description:
- * Initialize the caller provided struct usbhost_devaddr_s instance in
- * preparation for the management of device addresses on behalf of an HCD.
- *
- *******************************************************************************/
-
-void usbhost_devaddr_initialize(FAR struct usbhost_devaddr_s *hcd)
-{
- DEBUGASSERT(hcd);
-
- memset(hcd, 0, sizeof(struct usbhost_devaddr_s));
- sem_init(&hcd->exclsem, 0, 1);
- hcd->next = 1;
-}
-
-/*******************************************************************************
- * Name: usbhost_devaddr_create
- *
- * Description:
- * 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.
- *
- *******************************************************************************/
-
-int usbhost_devaddr_create(FAR struct usbhost_devaddr_s *hcd,
- FAR void *associate)
-{
- FAR struct usbhost_devhash_s *hentry;
- uint8_t hvalue;
- int devaddr;
-
- /* Allocate a hash table entry */
-
- hentry = (FAR struct usbhost_devhash_s *)kmalloc(sizeof(struct usbhost_devhash_s));
- if (!hentry)
- {
- udbg("ERROR: Failed to allocate a hash table entry\n");
- return -ENOMEM;
- }
-
- /* Get exclusive access to the HCD device address data */
-
- usbhost_takesem(hcd);
-
- /* Allocate a device address */
-
- devaddr = usbhost_devaddr_allocate(hcd);
- if (devaddr < 0)
- {
- udbg("ERROR: Failed to allocate a device address\n");
- free(hentry);
- }
- else
- {
- /* Initialize the hash table entry */
-
- hentry->devaddr = devaddr;
- hentry->payload = associate;
-
- /* Add the new device address to the hash table */
-
- hvalue = usbhost_devaddr_hash(devaddr);
- hentry->flink = hcd->hashtab[hvalue];
- hcd->hashtab[hvalue] = hentry;
-
- /* Try to re-use the lowest numbered device addresses */
-
- if (hcd->next > devaddr)
- {
- hcd->next = devaddr;
- }
- }
-
- usbhost_givesem(hcd);
- return devaddr;
-}
-
-/*******************************************************************************
- * Name: usbhost_devaddr_find
- *
- * Description:
- * 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.
- *
- *******************************************************************************/
-
-FAR void *usbhost_devaddr_find(FAR struct usbhost_devaddr_s *hcd,
- uint8_t devaddr)
-{
- FAR struct usbhost_devhash_s *hentry;
- uint8_t hvalue;
-
- /* Get exclusive access to the HCD device address data */
-
- hvalue = usbhost_devaddr_hash(devaddr);
- usbhost_takesem(hcd);
-
- /* Check each entry in the hash table */
-
- for (hentry = hcd->hashtab[hvalue]; hentry; hentry = hentry->flink)
- {
- /* Is this the address we are looking for? */
-
- if (hentry->devaddr == devaddr)
- {
- /* Yes.. return the payload from the hash table entry */
-
- usbhost_givesem(hcd);
- return hentry->payload;
- }
- }
-
- /* Didn't find the device address */
-
- usbhost_givesem(hcd);
- return NULL;
-}
-
-/*******************************************************************************
- * Name: usbhost_devaddr_destroy
- *
- * Description:
- * Release a device address previously allocated by usbhost_devaddr_destroy()
- * and destroy the association with the void* data.
- *
- *******************************************************************************/
-
-void usbhost_devaddr_destroy(FAR struct usbhost_devaddr_s *hcd, uint8_t devaddr)
-{
- FAR struct usbhost_devhash_s *hentry;
- FAR struct usbhost_devhash_s *prev;
- uint8_t hvalue;
-
- /* Get exclusive access to the HCD device address data */
-
- hvalue = usbhost_devaddr_hash(devaddr);
- usbhost_takesem(hcd);
-
- /* Search the hast table for the matching entry */
-
- for (hentry = hcd->hashtab[hvalue], prev = NULL;
- hentry;
- prev = hentry, hentry = hentry->flink)
- {
- /* Is this the address we are looking for? */
-
- if (hentry->devaddr == devaddr)
- {
- /* Yes.. remove the entry from the hash list */
-
- if (prev)
- {
- prev->flink = hentry->flink;
- }
- else
- {
- hcd->hashtab[hvalue] = hentry->flink;
- }
-
- /* And release the entry */
-
- kfree(hentry);
- break;
- }
- }
-
- usbhost_givesem(hcd);
-}
+/******************************************************************************* + * drivers/usbhost/usbhost_devaddr.c + * Manage USB device addresses + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Authors: Gregory Nutt <gnutt@nuttx.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *******************************************************************************/ + +/******************************************************************************* + * Included Files + *******************************************************************************/ + +#include <nuttx/config.h> + +#include <string.h> +#include <errno.h> +#include <debug.h> + +#include <nuttx/kmalloc.h> +#include <nuttx/usb/usbhost_devaddr.h> + +/******************************************************************************* + * Pre-processor Definitions + *******************************************************************************/ + +/******************************************************************************* + * Private Functions + *******************************************************************************/ + +/**************************************************************************** + * Name: usbhost_takesem and usbhost_givesem + * + * Description: + * This is just a wrapper to handle the annoying behavior of semaphore + * waits that return due to the receipt of a signal. + * + *******************************************************************************/ + +static void usbhost_takesem(FAR struct usbhost_devaddr_s *hcd) +{ + /* Take the semaphore (perhaps waiting) */ + + while (sem_wait(&hcd->exclsem) != 0) + { + /* The only case that an error should occr here is if the wait was + * awakened by a signal. + */ + + ASSERT(errno == EINTR); + } +} + +#define usbhost_givesem(hcd) sem_post(&hcd->exclsem) + +/******************************************************************************* + * Name: usbhost_devaddr_hash + * + * Description: + * Create a hash value from a device address. + * + *******************************************************************************/ + +static inline uint8_t usbhost_devaddr_hash(uint8_t devaddr) +{ + uint8_t ret = devaddr; + + ret ^= (devaddr >> 2); + ret ^= (devaddr >> 3); + return ret & USBHOST_DEVADDR_HASHMASK; +} + +/******************************************************************************* + * Name: usbhost_devaddr_allocate + * + * Description: + * Allocate a new unique device address for this HCD. + * + * Assumptions: + * Caller hold the exclsem + * + *******************************************************************************/ + +static int usbhost_devaddr_allocate(FAR struct usbhost_devaddr_s *hcd) +{ + uint8_t startaddr = hcd->next; + uint8_t devaddr; + int index; + int bitno; + + /* Loop until we find a valid device address */ + + for (;;) + { + /* Try the next device address */ + + devaddr = hcd->next; + if (hcd->next >= 0x7f) + { + hcd->next = 1; + } + else + { + hcd->next++; + } + + /* Is this address already allocated? */ + + index = devaddr >> 5; + bitno = devaddr & 0x1f; + if ((hcd->alloctab[index] & (1 << bitno)) == 0) + { + /* No... allocate it now */ + + hcd->alloctab[index] |= (1 << bitno); + return (int)devaddr; + } + + /* This address has already been allocated. The followign logic will + * prevent (unexpected) infinite loops. + */ + + if (startaddr == devaddr) + { + /* We are back where we started... the are no free device address */ + + return -ENOMEM; + } + } +} + +/******************************************************************************* + * Public Functions + *******************************************************************************/ + +/******************************************************************************* + * Name: usbhost_devaddr_initialize + * + * Description: + * Initialize the caller provided struct usbhost_devaddr_s instance in + * preparation for the management of device addresses on behalf of an HCD. + * + *******************************************************************************/ + +void usbhost_devaddr_initialize(FAR struct usbhost_devaddr_s *hcd) +{ + DEBUGASSERT(hcd); + + memset(hcd, 0, sizeof(struct usbhost_devaddr_s)); + sem_init(&hcd->exclsem, 0, 1); + hcd->next = 1; +} + +/******************************************************************************* + * Name: usbhost_devaddr_create + * + * Description: + * 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. + * + *******************************************************************************/ + +int usbhost_devaddr_create(FAR struct usbhost_devaddr_s *hcd, + FAR void *associate) +{ + FAR struct usbhost_devhash_s *hentry; + uint8_t hvalue; + int devaddr; + + /* Allocate a hash table entry */ + + hentry = (FAR struct usbhost_devhash_s *)kmalloc(sizeof(struct usbhost_devhash_s)); + if (!hentry) + { + udbg("ERROR: Failed to allocate a hash table entry\n"); + return -ENOMEM; + } + + /* Get exclusive access to the HCD device address data */ + + usbhost_takesem(hcd); + + /* Allocate a device address */ + + devaddr = usbhost_devaddr_allocate(hcd); + if (devaddr < 0) + { + udbg("ERROR: Failed to allocate a device address\n"); + free(hentry); + } + else + { + /* Initialize the hash table entry */ + + hentry->devaddr = devaddr; + hentry->payload = associate; + + /* Add the new device address to the hash table */ + + hvalue = usbhost_devaddr_hash(devaddr); + hentry->flink = hcd->hashtab[hvalue]; + hcd->hashtab[hvalue] = hentry; + + /* Try to re-use the lowest numbered device addresses */ + + if (hcd->next > devaddr) + { + hcd->next = devaddr; + } + } + + usbhost_givesem(hcd); + return devaddr; +} + +/******************************************************************************* + * Name: usbhost_devaddr_find + * + * Description: + * 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. + * + *******************************************************************************/ + +FAR void *usbhost_devaddr_find(FAR struct usbhost_devaddr_s *hcd, + uint8_t devaddr) +{ + FAR struct usbhost_devhash_s *hentry; + uint8_t hvalue; + + /* Get exclusive access to the HCD device address data */ + + hvalue = usbhost_devaddr_hash(devaddr); + usbhost_takesem(hcd); + + /* Check each entry in the hash table */ + + for (hentry = hcd->hashtab[hvalue]; hentry; hentry = hentry->flink) + { + /* Is this the address we are looking for? */ + + if (hentry->devaddr == devaddr) + { + /* Yes.. return the payload from the hash table entry */ + + usbhost_givesem(hcd); + return hentry->payload; + } + } + + /* Didn't find the device address */ + + usbhost_givesem(hcd); + return NULL; +} + +/******************************************************************************* + * Name: usbhost_devaddr_destroy + * + * Description: + * Release a device address previously allocated by usbhost_devaddr_destroy() + * and destroy the association with the void* data. + * + *******************************************************************************/ + +void usbhost_devaddr_destroy(FAR struct usbhost_devaddr_s *hcd, uint8_t devaddr) +{ + FAR struct usbhost_devhash_s *hentry; + FAR struct usbhost_devhash_s *prev; + uint8_t hvalue; + + /* Get exclusive access to the HCD device address data */ + + hvalue = usbhost_devaddr_hash(devaddr); + usbhost_takesem(hcd); + + /* Search the hast table for the matching entry */ + + for (hentry = hcd->hashtab[hvalue], prev = NULL; + hentry; + prev = hentry, hentry = hentry->flink) + { + /* Is this the address we are looking for? */ + + if (hentry->devaddr == devaddr) + { + /* Yes.. remove the entry from the hash list */ + + if (prev) + { + prev->flink = hentry->flink; + } + else + { + hcd->hashtab[hvalue] = hentry->flink; + } + + /* And release the entry */ + + kmm_free(hentry); + break; + } + } + + usbhost_givesem(hcd); +} diff --git a/nuttx/drivers/usbhost/usbhost_hidkbd.c b/nuttx/drivers/usbhost/usbhost_hidkbd.c index cbea5ade0..b18399e38 100644 --- a/nuttx/drivers/usbhost/usbhost_hidkbd.c +++ b/nuttx/drivers/usbhost/usbhost_hidkbd.c @@ -690,7 +690,7 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *class) /* Free the class instance. */ uvdbg("Freeing: %p\n", class);; - kfree(class); + kmm_free(class); } /**************************************************************************** diff --git a/nuttx/drivers/usbhost/usbhost_hidmouse.c b/nuttx/drivers/usbhost/usbhost_hidmouse.c index 0f93ff06c..3d5752941 100644 --- a/nuttx/drivers/usbhost/usbhost_hidmouse.c +++ b/nuttx/drivers/usbhost/usbhost_hidmouse.c @@ -545,7 +545,7 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *class) /* Free the class instance. */ uvdbg("Freeing: %p\n", class);; - kfree(class); + kmm_free(class); } /**************************************************************************** diff --git a/nuttx/drivers/usbhost/usbhost_skeleton.c b/nuttx/drivers/usbhost/usbhost_skeleton.c index 0603221c6..028441b72 100644 --- a/nuttx/drivers/usbhost/usbhost_skeleton.c +++ b/nuttx/drivers/usbhost/usbhost_skeleton.c @@ -276,12 +276,12 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *class) { 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. */ uvdbg("Freeing: %p\n", class);; - kfree(class); + kmm_free(class); } /**************************************************************************** diff --git a/nuttx/drivers/usbhost/usbhost_storage.c b/nuttx/drivers/usbhost/usbhost_storage.c index 2a8a2e961..a3ff5ed4f 100644 --- a/nuttx/drivers/usbhost/usbhost_storage.c +++ b/nuttx/drivers/usbhost/usbhost_storage.c @@ -433,12 +433,12 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *class) { 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. */ uvdbg("Freeing: %p\n", class);; - kfree(class); + kmm_free(class); } #endif diff --git a/nuttx/drivers/watchdog.c b/nuttx/drivers/watchdog.c index 78fc58df3..a5826b0e6 100644 --- a/nuttx/drivers/watchdog.c +++ b/nuttx/drivers/watchdog.c @@ -518,11 +518,11 @@ FAR void *watchdog_register(FAR const char *path, return (FAR void *)upper; errout_with_path: - kfree(upper->path); + kmm_free(upper->path); errout_with_upper: sem_destroy(&upper->exclsem); - kfree(upper); + kmm_free(upper); errout: return NULL; @@ -567,9 +567,9 @@ void watchdog_unregister(FAR void *handle) /* Then free all of the driver resources */ - kfree(upper->path); + kmm_free(upper->path); sem_destroy(&upper->exclsem); - kfree(upper); + kmm_free(upper); } #endif /* CONFIG_WATCHDOG */ diff --git a/nuttx/drivers/wireless/cc1101.c b/nuttx/drivers/wireless/cc1101.c index b573a5342..69d88de2b 100644 --- a/nuttx/drivers/wireless/cc1101.c +++ b/nuttx/drivers/wireless/cc1101.c @@ -520,7 +520,7 @@ struct cc1101_dev_s * cc1101_init(struct spi_dev_s * spi, uint8_t isrpin, if (cc1101_reset(dev) < 0) { - kfree(dev); + kmm_free(dev); errno = EFAULT; 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) { - kfree(dev); + kmm_free(dev); errno = ENODEV; return NULL; } @@ -579,7 +579,7 @@ int cc1101_deinit(struct cc1101_dev_s * dev) /* Release external interrupt line */ - kfree(dev); + kmm_free(dev); return 0; } diff --git a/nuttx/drivers/wireless/cc3000/cc3000.c b/nuttx/drivers/wireless/cc3000/cc3000.c index e11ed7d72..5f415c1f6 100644 --- a/nuttx/drivers/wireless/cc3000/cc3000.c +++ b/nuttx/drivers/wireless/cc3000/cc3000.c @@ -983,7 +983,7 @@ static int cc3000_close(FAR struct file *filep) mq_close(priv->queue); priv->queue = 0; - kfree(priv->rx_buffer.pbuffer); + kmm_free(priv->rx_buffer.pbuffer); priv->rx_buffer.pbuffer = 0; } @@ -1598,7 +1598,7 @@ errout_with_priv: #endif #ifdef CONFIG_CC3000_MULTIPLE - kfree(priv); + kmm_free(priv); #endif return ret; } diff --git a/nuttx/drivers/wireless/nrf24l01.c b/nuttx/drivers/wireless/nrf24l01.c index 71c3cb5ab..f7a51fde7 100644 --- a/nuttx/drivers/wireless/nrf24l01.c +++ b/nuttx/drivers/wireless/nrf24l01.c @@ -1198,9 +1198,9 @@ static int nrf24l01_unregister(FAR struct nrf24l01_dev_s *dev) /* Free memory */ #ifdef CONFIG_WL_NRF24L01_RXSUPPORT - kfree(dev->rx_fifo); + kmm_free(dev->rx_fifo); #endif - kfree(dev); + kmm_free(dev); 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 if ((rx_fifo = kmalloc(CONFIG_WL_NRF24L01_RXFIFO_LEN)) == NULL) { - kfree(dev); + kmm_free(dev); return -ENOMEM; } diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c index 3890810d4..677924057 100644 --- a/nuttx/fs/fat/fs_fat32.c +++ b/nuttx/fs/fat/fs_fat32.c @@ -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); if (offset < 0) { - kfree(ff); + kmm_free(ff); return (int)offset; } } @@ -375,7 +375,7 @@ static int fat_open(FAR struct file *filep, const char *relpath, */ errout_with_struct: - kfree(ff); + kmm_free(ff); errout_with_semaphore: fat_semgive(fs); @@ -425,7 +425,7 @@ static int fat_close(FAR struct file *filep) /* Then free the file structure itself. */ - kfree(ff); + kmm_free(ff); filep->f_priv = NULL; return ret; } @@ -1417,7 +1417,7 @@ static int fat_dup(FAR const struct file *oldp, FAR struct file *newp) */ errout_with_struct: - kfree(newff); + kmm_free(newff); errout_with_semaphore: fat_semgive(fs); @@ -1778,7 +1778,7 @@ static int fat_bind(FAR struct inode *blkdriver, const void *data, if (ret != 0) { sem_destroy(&fs->fs_sem); - kfree(fs); + kmm_free(fs); 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); } - kfree(fs); + kmm_free(fs); } fat_semgive(fs); diff --git a/nuttx/fs/fat/fs_fat32.h b/nuttx/fs/fat/fs_fat32.h index 2606aca45..8670743ef 100644 --- a/nuttx/fs/fat/fs_fat32.h +++ b/nuttx/fs/fat/fs_fat32.h @@ -701,8 +701,8 @@ # define fat_io_alloc(s) fat_dma_alloc(s) # define fat_io_free(m,s) fat_dma_free(m,s) #else -# define fat_io_alloc(s) kmalloc(s) -# define fat_io_free(m,s) kfree(m) +# define fat_io_alloc(s) kmm_malloc(s) +# define fat_io_free(m,s) kmm_free(m) #endif /**************************************************************************** diff --git a/nuttx/fs/fat/fs_mkfatfs.c b/nuttx/fs/fat/fs_mkfatfs.c index 1191768f8..4445c5a4c 100644 --- a/nuttx/fs/fat/fs_mkfatfs.c +++ b/nuttx/fs/fat/fs_mkfatfs.c @@ -319,7 +319,7 @@ errout: if (var.fv_sect) { - kfree(var.fv_sect); + kmm_free(var.fv_sect); } /* Return any reported errors */ diff --git a/nuttx/fs/fs_automount.c b/nuttx/fs/fs_automount.c index 5e35f0b68..ff40c9230 100644 --- a/nuttx/fs/fs_automount.c +++ b/nuttx/fs/fs_automount.c @@ -633,5 +633,5 @@ void automount_uninitialize(FAR void *handle) /* And free the state structure */ - kfree(priv); + kmm_free(priv); } diff --git a/nuttx/fs/fs_foreachinode.c b/nuttx/fs/fs_foreachinode.c index 17c684cf7..b1b6439d7 100644 --- a/nuttx/fs/fs_foreachinode.c +++ b/nuttx/fs/fs_foreachinode.c @@ -208,7 +208,7 @@ int foreach_inode(foreach_inode_t handler, FAR void *arg) /* Free the info structure and return the result */ - kfree(info); + kmm_free(info); return ret; #else diff --git a/nuttx/fs/fs_inode.c b/nuttx/fs/fs_inode.c index e3133088f..6d2b741ea 100644 --- a/nuttx/fs/fs_inode.c +++ b/nuttx/fs/fs_inode.c @@ -400,7 +400,7 @@ void inode_free(FAR struct inode *node) { inode_free(node->i_peer); inode_free(node->i_child); - kfree(node); + kmm_free(node); } } diff --git a/nuttx/fs/fs_inoderelease.c b/nuttx/fs/fs_inoderelease.c index bc5026534..0040426d6 100644 --- a/nuttx/fs/fs_inoderelease.c +++ b/nuttx/fs/fs_inoderelease.c @@ -95,7 +95,7 @@ void inode_release(FAR struct inode *node) { inode_semgive(); inode_free(node->i_child); - kfree(node); + kmm_free(node); } else { diff --git a/nuttx/fs/fs_inoderemove.c b/nuttx/fs/fs_inoderemove.c index 8258b1151..3466d8952 100644 --- a/nuttx/fs/fs_inoderemove.c +++ b/nuttx/fs/fs_inoderemove.c @@ -170,7 +170,7 @@ int inode_remove(FAR const char *path) /* And delete it now -- recursively to delete all of its children */ inode_free(node->i_child); - kfree(node); + kmm_free(node); return OK; } } diff --git a/nuttx/fs/fs_select.c b/nuttx/fs/fs_select.c index 2b4fdf543..556591b9e 100644 --- a/nuttx/fs/fs_select.c +++ b/nuttx/fs/fs_select.c @@ -262,7 +262,7 @@ int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds, } } - kfree(pollset); + kmm_free(pollset); return ret; } diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c index 54bfcd153..6654f3baf 100644 --- a/nuttx/fs/nfs/nfs_vfsops.c +++ b/nuttx/fs/nfs/nfs_vfsops.c @@ -656,7 +656,7 @@ static int nfs_open(FAR struct file *filep, FAR const char *relpath, errout_with_semaphore: if (np) { - kfree(np); + kmm_free(np); } nfs_semgive(nmp); @@ -745,7 +745,7 @@ static int nfs_close(FAR struct file *filep) /* Then deallocate the file structure and return success */ - kfree(np); + kmm_free(np); ret = OK; break; } @@ -1840,15 +1840,15 @@ bad: sem_destroy(&nmp->nm_sem); if (nmp->nm_so) { - kfree(nmp->nm_so); + kmm_free(nmp->nm_so); } if (nmp->nm_rpcclnt) { - kfree(nmp->nm_rpcclnt); + kmm_free(nmp->nm_rpcclnt); } - kfree(nmp); + kmm_free(nmp); } return error; @@ -1905,9 +1905,9 @@ int nfs_unbind(FAR void *handle, FAR struct inode **blkdriver) /* And free any allocated resources */ sem_destroy(&nmp->nm_sem); - kfree(nmp->nm_so); - kfree(nmp->nm_rpcclnt); - kfree(nmp); + kmm_free(nmp->nm_so); + kmm_free(nmp->nm_rpcclnt); + kmm_free(nmp); return -error; diff --git a/nuttx/fs/nxffs/nxffs.h b/nuttx/fs/nxffs/nxffs.h index 26e35f506..87bc06227 100644 --- a/nuttx/fs/nxffs/nxffs.h +++ b/nuttx/fs/nxffs/nxffs.h @@ -577,7 +577,7 @@ int nxffs_getc(FAR struct nxffs_volume_s *volume, uint16_t reserve); * to dispose of that memory when the inode entry is no longer needed. * * Note that the nxffs_entry_s containing structure is not freed. The - * caller may call kfree upon return of this function if necessary to + * caller may call kmm_free upon return of this function if necessary to * free the entry container. * * Input parameters: diff --git a/nuttx/fs/nxffs/nxffs_dump.c b/nuttx/fs/nxffs/nxffs_dump.c index c42a007db..2cc50b1e0 100644 --- a/nuttx/fs/nxffs/nxffs_dump.c +++ b/nuttx/fs/nxffs/nxffs_dump.c @@ -465,7 +465,7 @@ int nxffs_dump(FAR struct mtd_dev_s *mtd, bool verbose) /* Read errors are fatal */ fdbg("ERROR: Failed to read block %d\n", blkinfo.block); - kfree(blkinfo.buffer); + kmm_free(blkinfo.buffer); return ret; #else /* A read error is probably fatal on all media but NAND. @@ -488,7 +488,7 @@ int nxffs_dump(FAR struct mtd_dev_s *mtd, bool verbose) fdbg("%d blocks analyzed\n", blkinfo.nblocks); - kfree(blkinfo.buffer); + kmm_free(blkinfo.buffer); return OK; #else diff --git a/nuttx/fs/nxffs/nxffs_initialize.c b/nuttx/fs/nxffs/nxffs_initialize.c index ec5239545..34ac847ad 100644 --- a/nuttx/fs/nxffs/nxffs_initialize.c +++ b/nuttx/fs/nxffs/nxffs_initialize.c @@ -313,12 +313,12 @@ int nxffs_initialize(FAR struct mtd_dev_s *mtd) fdbg("ERROR: Failed to calculate file system limits: %d\n", -ret); errout_with_buffer: - kfree(volume->pack); + kmm_free(volume->pack); errout_with_cache: - kfree(volume->cache); + kmm_free(volume->cache); errout_with_volume: #ifndef CONFIG_NXFFS_PREALLOCATED - kfree(volume); + kmm_free(volume); #endif return ret; } diff --git a/nuttx/fs/nxffs/nxffs_inode.c b/nuttx/fs/nxffs/nxffs_inode.c index 7efcbd5f2..4af7cfe41 100644 --- a/nuttx/fs/nxffs/nxffs_inode.c +++ b/nuttx/fs/nxffs/nxffs_inode.c @@ -222,7 +222,7 @@ errout: * to dispose of that memory when the inode entry is no longer needed. * * Note that the nxffs_entry_s containing structure is not freed. The - * caller may call kfree upon return of this function if necessary to + * caller may call kmm_free upon return of this function if necessary to * free the entry container. * * Input parameters: @@ -237,7 +237,7 @@ void nxffs_freeentry(FAR struct nxffs_entry_s *entry) { if (entry->name) { - kfree(entry->name); + kmm_free(entry->name); entry->name = NULL; } } diff --git a/nuttx/fs/nxffs/nxffs_open.c b/nuttx/fs/nxffs/nxffs_open.c index 2859c31bd..d049ef693 100644 --- a/nuttx/fs/nxffs/nxffs_open.c +++ b/nuttx/fs/nxffs/nxffs_open.c @@ -678,10 +678,10 @@ static inline int nxffs_wropen(FAR struct nxffs_volume_s *volume, return OK; errout_with_name: - kfree(wrfile->ofile.entry.name); + kmm_free(wrfile->ofile.entry.name); errout_with_ofile: #ifndef CONFIG_NXFFS_PREALLOCATED - kfree(wrfile); + kmm_free(wrfile); #endif errout_with_exclsem: @@ -785,7 +785,7 @@ static inline int nxffs_rdopen(FAR struct nxffs_volume_s *volume, return OK; errout_with_ofile: - kfree(ofile); + kmm_free(ofile); errout_with_exclsem: sem_post(&volume->exclsem); errout: @@ -856,7 +856,7 @@ static inline void nxffs_freeofile(FAR struct nxffs_volume_s *volume, if ((FAR struct nxffs_wrfile_s*)ofile != &g_wrfile) #endif { - kfree(ofile); + kmm_free(ofile); } } diff --git a/nuttx/fs/procfs/fs_procfs.c b/nuttx/fs/procfs/fs_procfs.c index 8969e8948..3351d7bf8 100644 --- a/nuttx/fs/procfs/fs_procfs.c +++ b/nuttx/fs/procfs/fs_procfs.c @@ -337,7 +337,7 @@ static int procfs_close(FAR struct file *filep) /* Release the file attributes structure */ - kfree(attr); + kmm_free(attr); filep->f_priv = NULL; return OK; } @@ -557,7 +557,7 @@ static int procfs_closedir(FAR struct inode *mountpt, if (priv) { - kfree(priv); + kmm_free(priv); } dir->u.procfs = NULL; diff --git a/nuttx/fs/procfs/fs_procfscpuload.c b/nuttx/fs/procfs/fs_procfscpuload.c index 93776b496..e6bc1b398 100644 --- a/nuttx/fs/procfs/fs_procfscpuload.c +++ b/nuttx/fs/procfs/fs_procfscpuload.c @@ -194,7 +194,7 @@ static int cpuload_close(FAR struct file *filep) /* Release the file attributes structure */ - kfree(attr); + kmm_free(attr); filep->f_priv = NULL; return OK; } diff --git a/nuttx/fs/procfs/fs_procfsproc.c b/nuttx/fs/procfs/fs_procfsproc.c index c5b1b67c3..50cec9ed2 100644 --- a/nuttx/fs/procfs/fs_procfsproc.c +++ b/nuttx/fs/procfs/fs_procfsproc.c @@ -1011,7 +1011,7 @@ static int proc_close(FAR struct file *filep) /* Release the file container structure */ - kfree(procfile); + kmm_free(procfile); filep->f_priv = NULL; return OK; } @@ -1221,7 +1221,7 @@ static int proc_opendir(FAR const char *relpath, FAR struct fs_dirent_s *dir) if (!node) { fdbg("ERROR: Invalid path \"%s\"\n", relpath); - kfree(procdir); + kmm_free(procdir); return -ENOENT; } @@ -1230,7 +1230,7 @@ static int proc_opendir(FAR const char *relpath, FAR struct fs_dirent_s *dir) if (node->dtype != DTYPE_DIRECTORY) { fdbg("ERROR: Path \"%s\" is not a directory\n", relpath); - kfree(procdir); + kmm_free(procdir); return -ENOTDIR; } @@ -1270,7 +1270,7 @@ static int proc_closedir(FAR struct fs_dirent_s *dir) if (priv) { - kfree(priv); + kmm_free(priv); } dir->u.procfs = NULL; diff --git a/nuttx/fs/procfs/fs_procfsuptime.c b/nuttx/fs/procfs/fs_procfsuptime.c index 8d077b24f..acbeb5595 100644 --- a/nuttx/fs/procfs/fs_procfsuptime.c +++ b/nuttx/fs/procfs/fs_procfsuptime.c @@ -196,7 +196,7 @@ static int uptime_close(FAR struct file *filep) /* Release the file attributes structure */ - kfree(attr); + kmm_free(attr); filep->f_priv = NULL; return OK; } diff --git a/nuttx/fs/procfs/fs_skeleton.c b/nuttx/fs/procfs/fs_skeleton.c index 5054cb49b..28f5ff051 100644 --- a/nuttx/fs/procfs/fs_skeleton.c +++ b/nuttx/fs/procfs/fs_skeleton.c @@ -210,7 +210,7 @@ static int skel_close(FAR struct file *filep) /* Release the file attributes structure */ - kfree(priv); + kmm_free(priv); filep->f_priv = NULL; return OK; } @@ -342,7 +342,7 @@ static int skel_closedir(FAR struct fs_dirent_s *dir) if (priv) { - kfree(priv); + kmm_free(priv); } dir->u.procfs = NULL; diff --git a/nuttx/fs/romfs/fs_romfs.c b/nuttx/fs/romfs/fs_romfs.c index e2999f364..1197270ef 100644 --- a/nuttx/fs/romfs/fs_romfs.c +++ b/nuttx/fs/romfs/fs_romfs.c @@ -318,12 +318,12 @@ static int romfs_close(FAR struct file *filep) if (!rm->rm_xipbase && rf->rf_buffer) { - kfree(rf->rf_buffer); + kmm_free(rf->rf_buffer); } /* Then free the file structure itself. */ - kfree(rf); + kmm_free(rf); filep->f_priv = NULL; return ret; } @@ -960,12 +960,12 @@ static int romfs_bind(FAR struct inode *blkdriver, FAR const void *data, errout_with_buffer: if (!rm->rm_xipbase) { - kfree(rm->rm_buffer); + kmm_free(rm->rm_buffer); } errout_with_sem: sem_destroy(&rm->rm_sem); - kfree(rm); + kmm_free(rm); return ret; } @@ -1032,11 +1032,11 @@ static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver) if (!rm->rm_xipbase && rm->rm_buffer) { - kfree(rm->rm_buffer); + kmm_free(rm->rm_buffer); } sem_destroy(&rm->rm_sem); - kfree(rm); + kmm_free(rm); return OK; } diff --git a/nuttx/fs/smartfs/smartfs_procfs.c b/nuttx/fs/smartfs/smartfs_procfs.c index 9bac410ea..8f8ff3d4f 100644 --- a/nuttx/fs/smartfs/smartfs_procfs.c +++ b/nuttx/fs/smartfs/smartfs_procfs.c @@ -210,7 +210,7 @@ static int smartfs_close(FAR struct file *filep) /* Release the file attributes structure */ - kfree(priv); + kmm_free(priv); filep->f_priv = NULL; return OK; } @@ -342,7 +342,7 @@ static int smartfs_closedir(FAR struct fs_dirent_s *dir) if (priv) { - kfree(priv); + kmm_free(priv); } dir->u.procfs = NULL; diff --git a/nuttx/fs/smartfs/smartfs_smart.c b/nuttx/fs/smartfs/smartfs_smart.c index 42878a779..fe398fa68 100644 --- a/nuttx/fs/smartfs/smartfs_smart.c +++ b/nuttx/fs/smartfs/smartfs_smart.c @@ -328,11 +328,11 @@ errout_with_buffer: { /* Free the space for the name too */ - kfree(sf->entry.name); + kmm_free(sf->entry.name); sf->entry.name = NULL; } - kfree(sf); + kmm_free(sf); errout_with_semaphore: smartfs_semgive(fs); @@ -423,10 +423,10 @@ static int smartfs_close(FAR struct file *filep) { /* Free the space for the name too */ - kfree(sf->entry.name); + kmm_free(sf->entry.name); sf->entry.name = NULL; } - kfree(sf); + kmm_free(sf); okout: smartfs_semgive(fs); @@ -1143,7 +1143,7 @@ errout_with_semaphore: if (entry.name != NULL) { - kfree(entry.name); + kmm_free(entry.name); entry.name = NULL; } @@ -1372,7 +1372,7 @@ static int smartfs_bind(FAR struct inode *blkdriver, const void *data, ret = smartfs_mount(fs, true); if (ret != 0) { - kfree(fs); + kmm_free(fs); smartfs_semgive(fs); return ret; } @@ -1420,7 +1420,7 @@ static int smartfs_unbind(void *handle, FAR struct inode **blkdriver) } smartfs_semgive(fs); - kfree(fs); + kmm_free(fs); return ret; } @@ -1604,7 +1604,7 @@ errout_with_semaphore: { /* Free the filename space allocation */ - kfree(entry.name); + kmm_free(entry.name); entry.name = NULL; } @@ -1885,13 +1885,13 @@ int smartfs_rename(struct inode *mountpt, const char *oldrelpath, errout_with_semaphore: if (oldentry.name != NULL) { - kfree(oldentry.name); + kmm_free(oldentry.name); oldentry.name = NULL; } if (newentry.name != NULL) { - kfree(newentry.name); + kmm_free(newentry.name); newentry.name = NULL; } @@ -1967,7 +1967,7 @@ static int smartfs_stat(struct inode *mountpt, const char *relpath, struct stat errout_with_semaphore: if (entry.name != NULL) { - kfree(entry.name); + kmm_free(entry.name); entry.name = NULL; } diff --git a/nuttx/fs/smartfs/smartfs_utils.c b/nuttx/fs/smartfs/smartfs_utils.c index 3c41ce524..86b43cb09 100644 --- a/nuttx/fs/smartfs/smartfs_utils.c +++ b/nuttx/fs/smartfs/smartfs_utils.c @@ -340,8 +340,8 @@ int smartfs_unmount(struct smartfs_mountpt_s *fs) /* Free the buffers */ - kfree(fs->fs_rwbuffer); - kfree(fs->fs_workbuffer); + kmm_free(fs->fs_rwbuffer); + kmm_free(fs->fs_workbuffer); /* Set the buffer's to invalid value to catch program bugs */ @@ -378,8 +378,8 @@ int smartfs_unmount(struct smartfs_mountpt_s *fs) /* Release the mountpoint private data */ - kfree(fs->fs_rwbuffer); - kfree(fs->fs_workbuffer); + kmm_free(fs->fs_rwbuffer); + kmm_free(fs->fs_workbuffer); #endif return ret; diff --git a/nuttx/graphics/nxbe/nxbe_clipper.c b/nuttx/graphics/nxbe/nxbe_clipper.c index 88b6ef2f6..c5217bcf3 100644 --- a/nuttx/graphics/nxbe/nxbe_clipper.c +++ b/nuttx/graphics/nxbe/nxbe_clipper.c @@ -262,7 +262,7 @@ void nxbe_clipper(FAR struct nxbe_window_s *wnd, if (stack.stack) { - kfree(stack.stack); + kmm_free(stack.stack); } } diff --git a/nuttx/graphics/nxbe/nxbe_colormap.c b/nuttx/graphics/nxbe/nxbe_colormap.c index 89e6baace..3a9a2506a 100644 --- a/nuttx/graphics/nxbe/nxbe_colormap.c +++ b/nuttx/graphics/nxbe/nxbe_colormap.c @@ -152,7 +152,7 @@ int nxbe_colormap(FAR NX_DRIVERTYPE *dev) ret = dev->putcmap(dev, &cmap); - kfree(alloc); + kmm_free(alloc); return ret; } #endif diff --git a/nuttx/graphics/nxconsole/nxcon_font.c b/nuttx/graphics/nxconsole/nxcon_font.c index ad91b99db..056a96637 100644 --- a/nuttx/graphics/nxconsole/nxcon_font.c +++ b/nuttx/graphics/nxconsole/nxcon_font.c @@ -102,7 +102,7 @@ static void nxcon_freeglyph(FAR struct nxcon_glyph_s *glyph) { if (glyph->bitmap) { - kfree(glyph->bitmap); + kmm_free(glyph->bitmap); } memset(glyph, 0, sizeof(struct nxcon_glyph_s)); } diff --git a/nuttx/graphics/nxconsole/nxcon_register.c b/nuttx/graphics/nxconsole/nxcon_register.c index cadda7394..0e660aff0 100644 --- a/nuttx/graphics/nxconsole/nxcon_register.c +++ b/nuttx/graphics/nxconsole/nxcon_register.c @@ -155,6 +155,6 @@ FAR struct nxcon_state_s * return (NXCONSOLE)priv; errout: - kfree(priv); + kmm_free(priv); return NULL; } diff --git a/nuttx/graphics/nxconsole/nxcon_unregister.c b/nuttx/graphics/nxconsole/nxcon_unregister.c index af6a53370..d0dc97b97 100644 --- a/nuttx/graphics/nxconsole/nxcon_unregister.c +++ b/nuttx/graphics/nxconsole/nxcon_unregister.c @@ -108,7 +108,7 @@ void nxcon_unregister(NXCONSOLE handle) FAR struct nxcon_glyph_s *glyph = &priv->glyph[i]; if (glyph->bitmap) { - kfree(glyph->bitmap); + kmm_free(glyph->bitmap); } } @@ -119,5 +119,5 @@ void nxcon_unregister(NXCONSOLE handle) /* Free the private data structure */ - kfree(handle); + kmm_free(handle); } diff --git a/nuttx/graphics/nxmu/nxmu_kbdin.c b/nuttx/graphics/nxmu/nxmu_kbdin.c index 1486a4d2b..eb3fc0717 100644 --- a/nuttx/graphics/nxmu/nxmu_kbdin.c +++ b/nuttx/graphics/nxmu/nxmu_kbdin.c @@ -111,7 +111,7 @@ void nxmu_kbdin(FAR struct nxfe_state_s *fe, uint8_t nch, FAR uint8_t *ch) } (void)nxmu_sendclientwindow(fe->be.topwnd, outmsg, size); - kfree(outmsg); + kmm_free(outmsg); } } diff --git a/nuttx/include/nuttx/binfmt/binfmt.h b/nuttx/include/nuttx/binfmt/binfmt.h index c2251253d..f53b3a2ae 100644 --- a/nuttx/include/nuttx/binfmt/binfmt.h +++ b/nuttx/include/nuttx/binfmt/binfmt.h @@ -262,7 +262,7 @@ int exec_module(FAR const struct binary_s *bin); * the parent of the newly created task to automatically unload 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() - * 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. * * Input Parameter: @@ -359,7 +359,7 @@ EXEPATH_HANDLE exepath_init(void); * is marked executable). * * 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 * 'relpath' from any absolute path in the PATH variable. In this case, diff --git a/nuttx/include/nuttx/kmalloc.h b/nuttx/include/nuttx/kmalloc.h index 050200c8e..13d8b7155 100644 --- a/nuttx/include/nuttx/kmalloc.h +++ b/nuttx/include/nuttx/kmalloc.h @@ -130,7 +130,7 @@ extern "C" # define kzalloc(s) zalloc(s) # define kmm_realloc(p,s) realloc(p,s) # define kmm_memalign(a,s) memalign(a,s) -# define kfree(p) free(p) +# define kmm_free(p) free(p) #elif !defined(CONFIG_MM_KERNEL_HEAP) /* If this the kernel phase of a kernel build, and there are only user-space @@ -147,7 +147,7 @@ extern "C" # define kzalloc(s) umm_zalloc(s) # define kmm_realloc(p,s) umm_realloc(p,s) # define kmm_memalign(a,s) umm_memalign(a,s) -# define kfree(p) umm_free(p) +# define kmm_free(p) umm_free(p) #else /* Otherwise, the kernel-space allocators are declared in include/nuttx/mm.h @@ -156,12 +156,11 @@ extern "C" FAR void *kmalloc(size_t size); FAR void *kzalloc(size_t size); -void kfree(FAR void *mem); #endif /* Functions defined in sched/sched_kfree.c **********************************/ -/* Handles memory freed from an interrupt handler. In that context, kfree() +/* Handles memory freed from an interrupt handler. In that context, kmm_free() * (or kumm_free()) cannot be called. Instead, the allocations are saved in a * list of delayed allocations that will be periodically cleaned up by * sched_garbagecollection(). @@ -180,7 +179,7 @@ void sched_kfree(FAR void *address); /* Functions defined in sched/sched_garbage *********************************/ /* Must be called periodically to clean up deallocations delayed by - * sched_kfree(). This may be done from either the IDLE thread or from a + * sched_kmm_free(). This may be done from either the IDLE thread or from a * worker thread. The IDLE thread has very low priority and could starve * the system for memory in some context. */ diff --git a/nuttx/include/nuttx/mm.h b/nuttx/include/nuttx/mm.h index 36c72ac3d..4de3d5912 100644 --- a/nuttx/include/nuttx/mm.h +++ b/nuttx/include/nuttx/mm.h @@ -319,6 +319,12 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size); void mm_free(FAR struct mm_heap_s *heap, FAR void *mem); +/* Functions contained in kmm_free.c ****************************************/ + +#ifdef CONFIG_MM_KERNEL_HEAP +void kmm_free(FAR void *mem); +#endif + /* Functions contained in mm_realloc.c **************************************/ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem, diff --git a/nuttx/include/nuttx/usb/usbhost.h b/nuttx/include/nuttx/usb/usbhost.h index b0133ca13..5c8d23df1 100644 --- a/nuttx/include/nuttx/usb/usbhost.h +++ b/nuttx/include/nuttx/usb/usbhost.h @@ -351,7 +351,7 @@ * Some hardware supports special memory in which request and descriptor data can * be accessed more efficiently. This method provides a mechanism to free that * 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: * drvr - The USB host driver instance obtained as a parameter from the call to @@ -405,7 +405,7 @@ * Some hardware supports special memory in which IO data can be accessed more * efficiently. This method provides a mechanism to free that IO buffer * 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: * drvr - The USB host driver instance obtained as a parameter from the call to @@ -676,7 +676,7 @@ struct usbhost_driver_s * be accessed more efficiently. The following methods provide a mechanism * to allocate and free the transfer descriptor memory. If the underlying * hardware does not support such "special" memory, these functions may - * simply map to kmalloc and kfree. + * simply map to kmalloc and kmm_free. * * This interface was optimized under a particular assumption. It was assumed * that the driver maintains a pool of small, pre-allocated buffers for descriptor diff --git a/nuttx/libc/lib_internal.h b/nuttx/libc/lib_internal.h index 4a7a71e77..829ea968e 100644 --- a/nuttx/libc/lib_internal.h +++ b/nuttx/libc/lib_internal.h @@ -86,11 +86,11 @@ /* Domain-specific allocations */ -# define lib_malloc(s) kmalloc(s) -# define lib_zalloc(s) kzalloc(s) +# define lib_malloc(s) kmm_malloc(s) +# define lib_zalloc(s) kmm_zalloc(s) # define lib_realloc(p,s) kmm_realloc(p,s) # define lib_memalign(p,s) kmm_memalign(p,s) -# define lib_free(p) kfree(p) +# define lib_free(p) kmm_free(p) /* User-accessible allocations */ diff --git a/nuttx/libnx/nxcontext.h b/nuttx/libnx/nxcontext.h index 43dee2593..95fdf7a82 100644 --- a/nuttx/libnx/nxcontext.h +++ b/nuttx/libnx/nxcontext.h @@ -68,11 +68,11 @@ /* Domain-specific allocations */ -# define lib_malloc(s) kmalloc(s) -# define lib_zalloc(s) kzalloc(s) +# define lib_malloc(s) kmm_malloc(s) +# define lib_zalloc(s) kmm_zalloc(s) # define lib_realloc(p,s) kmm_realloc(p,s) # define lib_memalign(p,s) kmm_memalign(p,s) -# define lib_free(p) kfree(p) +# define lib_free(p) kmm_free(p) /* User-accessible allocations */ diff --git a/nuttx/libxx/libxx_internal.hxx b/nuttx/libxx/libxx_internal.hxx index 1763d4858..6669e9005 100644 --- a/nuttx/libxx/libxx_internal.hxx +++ b/nuttx/libxx/libxx_internal.hxx @@ -55,10 +55,10 @@ #if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ defined(CONFIG_BUILD_KERNEL) # include <nuttx/kmalloc.h> -# define lib_malloc(s) kmalloc(s) -# define lib_zalloc(s) kzalloc(s) +# define lib_malloc(s) kmm_malloc(s) +# define lib_zalloc(s) kmm_zalloc(s) # define lib_realloc(p,s) kmm_realloc(p,s) -# define lib_free(p) kfree(p) +# define lib_free(p) kmm_free(p) #else # include <cstdlib> # define lib_malloc(s) malloc(s) diff --git a/nuttx/mm/kmm_free.c b/nuttx/mm/kmm_free.c index e118d7853..92b0059ba 100644 --- a/nuttx/mm/kmm_free.c +++ b/nuttx/mm/kmm_free.c @@ -59,7 +59,7 @@ ****************************************************************************/ /************************************************************************ - * Name: kfree + * Name: kmm_free * * Description: * Returns a chunk of kernel memory to the list of free nodes, merging @@ -73,7 +73,7 @@ * ************************************************************************/ -void kfree(FAR void *mem) +void kmm_free(FAR void *mem) { DEBUGASSERT(kmm_heapmember(mem)); mm_free(&g_kmmheap, mem); diff --git a/nuttx/net/socket/net_poll.c b/nuttx/net/socket/net_poll.c index 6e2232299..f60df2366 100644 --- a/nuttx/net/socket/net_poll.c +++ b/nuttx/net/socket/net_poll.c @@ -319,7 +319,7 @@ static inline int net_pollsetup(FAR struct socket *psock, return OK; errout_with_lock: - kfree(info); + kmm_free(info); net_unlock(flags); return ret; } @@ -374,7 +374,7 @@ static inline int net_pollteardown(FAR struct socket *psock, /* Then free the poll info container */ - kfree(info); + kmm_free(info); } return OK; diff --git a/nuttx/net/tcp/tcp_backlog.c b/nuttx/net/tcp/tcp_backlog.c index 78c41deab..2ed7523dd 100644 --- a/nuttx/net/tcp/tcp_backlog.c +++ b/nuttx/net/tcp/tcp_backlog.c @@ -205,7 +205,7 @@ int tcp_backlogdestroy(FAR struct tcp_conn_s *conn) /* Then free the entire backlog structure */ - kfree(blg); + kmm_free(blg); } return OK; diff --git a/nuttx/sched/environ/env_putenv.c b/nuttx/sched/environ/env_putenv.c index e0a69bf93..aef05fc82 100644 --- a/nuttx/sched/environ/env_putenv.c +++ b/nuttx/sched/environ/env_putenv.c @@ -109,7 +109,7 @@ int putenv(FAR const char *string) ret = setenv(pname, pequal+1, TRUE); } - kfree(pname); + kmm_free(pname); return ret; errout: diff --git a/nuttx/sched/group/group_create.c b/nuttx/sched/group/group_create.c index 4e1867dfc..352862eac 100644 --- a/nuttx/sched/group/group_create.c +++ b/nuttx/sched/group/group_create.c @@ -203,7 +203,7 @@ int group_allocate(FAR struct task_tcb_s *tcb) if (!group->tg_streamlist) { - kfree(group); + kmm_free(group); return -ENOMEM; } @@ -230,7 +230,7 @@ int group_allocate(FAR struct task_tcb_s *tcb) defined(CONFIG_BUILD_KERNEL)) && defined(CONFIG_MM_KERNEL_HEAP) kumm_free(group->tg_streamlist); #endif - kfree(group); + kmm_free(group); tcb->cmn.group = NULL; return ret; } @@ -281,7 +281,7 @@ int group_initialize(FAR struct task_tcb_s *tcb) group->tg_members = (FAR pid_t *)kmalloc(GROUP_INITIAL_MEMBERS*sizeof(pid_t)); if (!group->tg_members) { - kfree(group); + kmm_free(group); return -ENOMEM; } diff --git a/nuttx/sched/sched/sched_free.c b/nuttx/sched/sched/sched_free.c index f38cc4814..268e6dc0a 100644 --- a/nuttx/sched/sched/sched_free.c +++ b/nuttx/sched/sched/sched_free.c @@ -159,7 +159,7 @@ void sched_kfree(FAR void *address) { /* No.. just deallocate the memory now. */ - kfree(address); + kmm_free(address); kmm_givesemaphore(); } } diff --git a/nuttx/sched/sched/sched_garbage.c b/nuttx/sched/sched/sched_garbage.c index 2ab8a5460..fb1cdeb8f 100644 --- a/nuttx/sched/sched/sched_garbage.c +++ b/nuttx/sched/sched/sched_garbage.c @@ -151,7 +151,7 @@ static inline void sched_kcleanup(void) { /* Return the memory to the kernel heap */ - kfree(address); + kmm_free(address); } } } |