summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/fman/etc/mm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/freescale/fman/etc/mm.c')
-rw-r--r--drivers/net/ethernet/freescale/fman/etc/mm.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/net/ethernet/freescale/fman/etc/mm.c b/drivers/net/ethernet/freescale/fman/etc/mm.c
index 9fcc46e..7b9d201 100644
--- a/drivers/net/ethernet/freescale/fman/etc/mm.c
+++ b/drivers/net/ethernet/freescale/fman/etc/mm.c
@@ -246,7 +246,6 @@ static t_Error AddFree(t_MM *p_MM, uint64_t base, uint64_t end)
else
p_MM->freeBlocks[i] = p_CurrB->p_Next;
XX_Free(p_CurrB);
- p_CurrB = NULL;
}
break;
}
@@ -576,10 +575,7 @@ static uint64_t MmGetGreaterAlignment(t_MM *p_MM, uint64_t size, uint64_t alignm
/* calls Update routine to update a lists of free blocks */
if ( CutFree ( p_MM, holdBase, holdEnd ) != E_OK )
- {
- XX_Free(p_NewBusyB);
return (uint64_t)(ILLEGAL_BASE);
- }
/* insert the new busy block into the list of busy blocks */
AddBusy ( p_MM, p_NewBusyB );
@@ -621,15 +617,12 @@ t_Error MM_Init(t_Handle *h_MM, uint64_t base, uint64_t size)
/* Initializes counter of free memory to total size */
p_MM->freeMemSize = size;
- /* A busy list is empty */
- p_MM->busyBlocks = 0;
-
/* Initializes a new memory block */
if ((p_MM->memBlocks = CreateNewBlock(base, size)) == NULL)
- {
- MM_Free(p_MM);
RETURN_ERROR(MAJOR, E_NO_MEMORY, NO_MSG);
- }
+
+ /* A busy list is empty */
+ p_MM->busyBlocks = 0;
/* Initializes a new free block for each free list*/
for (i=0; i <= MM_MAX_ALIGNMENT; i++)
@@ -638,10 +631,7 @@ t_Error MM_Init(t_Handle *h_MM, uint64_t base, uint64_t size)
newSize = size - (newBase - base);
if ((p_MM->freeBlocks[i] = CreateFreeBlock(newBase, newSize)) == NULL)
- {
- MM_Free(p_MM);
RETURN_ERROR(MAJOR, E_NO_MEMORY, NO_MSG);
- }
}
*h_MM = p_MM;
@@ -764,7 +754,6 @@ uint64_t MM_Get(t_Handle h_MM, uint64_t size, uint64_t alignment, char* name)
if ( CutFree ( p_MM, holdBase, holdEnd ) != E_OK )
{
XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags);
- XX_Free(p_NewBusyB);
return (uint64_t)(ILLEGAL_BASE);
}
@@ -821,7 +810,6 @@ uint64_t MM_GetForce(t_Handle h_MM, uint64_t base, uint64_t size, char* name)
if ( CutFree ( p_MM, base, base+size ) != E_OK )
{
XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags);
- XX_Free(p_NewBusyB);
return (uint64_t)(ILLEGAL_BASE);
}
@@ -910,7 +898,6 @@ uint64_t MM_GetForceMin(t_Handle h_MM, uint64_t size, uint64_t alignment, uint64
if ( CutFree( p_MM, holdBase, holdEnd ) != E_OK )
{
XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags);
- XX_Free(p_NewBusyB);
return (uint64_t)(ILLEGAL_BASE);
}