summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2021-07-07 16:03:25 +0200
committerDaniel Hellstrom <daniel@gaisler.com>2021-08-26 11:47:45 +0200
commit339de54f9fc49799719080c9ed7c355758db597a (patch)
tree6ad0e67bca7584c80040a8e4454a2e3305571e61
parent6516288ebef0df62bdaa494baefb0c02beff6abb (diff)
drvmgr: avoid using calloc/malloc
Avoid to drag in filesystem layers etc. into binary, via errno being referenced from calloc/malloc.
-rw-r--r--cpukit/libdrvmgr/drvmgr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cpukit/libdrvmgr/drvmgr.c b/cpukit/libdrvmgr/drvmgr.c
index 43148fd76a..dee19df11a 100644
--- a/cpukit/libdrvmgr/drvmgr.c
+++ b/cpukit/libdrvmgr/drvmgr.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <rtems/malloc.h>
#include <drvmgr/drvmgr.h>
#include <drvmgr/drvmgr_confdefs.h>
@@ -249,7 +250,7 @@ static int do_dev_init(
* requests for this feature.
*/
if (dev->drv && dev->drv->dev_priv_size && !dev->priv) {
- dev->priv = malloc(dev->drv->dev_priv_size);
+ dev->priv = rtems_malloc(dev->drv->dev_priv_size);
memset(dev->priv, 0, dev->drv->dev_priv_size);
}
@@ -597,7 +598,7 @@ int drvmgr_alloc_dev(struct drvmgr_dev **pdev, int extra)
/* The extra memory "service" is aligned to 4 bytes boundary. */
size = ((sizeof(struct drvmgr_dev) + 3) & ~0x3) + extra;
- dev = (struct drvmgr_dev *)calloc(size, 1);
+ dev = (struct drvmgr_dev *)rtems_calloc(size, 1);
if (!dev) {
/* Failed to allocate device structure - critical error */
rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
@@ -616,7 +617,7 @@ int drvmgr_alloc_bus(struct drvmgr_bus **pbus, int extra)
/* The extra memory "service" is aligned to 4 bytes boundary. */
size = ((sizeof(struct drvmgr_bus) + 3) & ~0x3) + extra;
- bus = (struct drvmgr_bus *)calloc(size, 1);
+ bus = (struct drvmgr_bus *)rtems_calloc(size, 1);
if (!bus) {
/* Failed to allocate device structure - critical error */
rtems_fatal_error_occurred(RTEMS_NO_MEMORY);