summaryrefslogtreecommitdiffstats
path: root/bsps/sparc/shared/pci/grpci2dma.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-11-26 15:55:38 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-21 14:54:13 +0100
commit11f3b9a535ced87882a9792b01b3b7800d355482 (patch)
tree7e641e16744706f9d72a411e775429a30a7b02e5 /bsps/sparc/shared/pci/grpci2dma.c
parentspcxx01: Add test case (diff)
downloadrtems-11f3b9a535ced87882a9792b01b3b7800d355482.tar.bz2
bsps/sparc: Add grlib_malloc(), grlib_calloc()
This avoids a dependency to errno in device driver code.
Diffstat (limited to '')
-rw-r--r--bsps/sparc/shared/pci/grpci2dma.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/bsps/sparc/shared/pci/grpci2dma.c b/bsps/sparc/shared/pci/grpci2dma.c
index 92c2038de0..0bc06ff50d 100644
--- a/bsps/sparc/shared/pci/grpci2dma.c
+++ b/bsps/sparc/shared/pci/grpci2dma.c
@@ -1285,7 +1285,7 @@ STATIC int grpci2dma_data_print(struct grpci2_bd_data * data)
void * grpci2dma_channel_new(int number)
{
/* Allocate memory */
- unsigned int * orig_ptr = (unsigned int *) malloc(
+ unsigned int * orig_ptr = (unsigned int *) grlib_malloc(
(GRPCI2DMA_BD_CHAN_SIZE)*number + GRPCI2DMA_BD_CHAN_ALIGN);
if (orig_ptr == NULL) return NULL;
@@ -1317,7 +1317,7 @@ void grpci2dma_channel_delete(void * chan)
void * grpci2dma_data_new(int number)
{
/* Allocate memory */
- unsigned int * orig_ptr = (unsigned int *) malloc(
+ unsigned int * orig_ptr = (unsigned int *) grlib_malloc(
(GRPCI2DMA_BD_DATA_SIZE)*number + GRPCI2DMA_BD_DATA_ALIGN);
if (orig_ptr == NULL) return NULL;
@@ -1375,13 +1375,10 @@ int grpci2dma_init(
return -1;
/* Allocate and init Memory for DMA */
- int size = sizeof(struct grpci2dma_priv);
- priv = (struct grpci2dma_priv *) malloc(size);
+ priv = grlib_calloc(1, sizeof(*priv));
if (priv == NULL)
return DRVMGR_NOMEM;
- /* Initialize all fields */
- memset(priv, 0, size);
priv->regs = regs;
strncpy(&priv->devname[0], "grpci2dma0", DEVNAME_LEN);