diff options
author | Mandy Lavi <mandy.lavi@freescale.com> | 2014-11-02 13:28:00 (GMT) |
---|---|---|
committer | Matthew Weigel <Matthew.Weigel@freescale.com> | 2014-12-11 18:40:40 (GMT) |
commit | 6337363a3c85f8da8a524a56c32829dbd7ae3433 (patch) | |
tree | 679e8896a6c6814e6cadd639618d90a0ad0a869c /drivers/net/ethernet/freescale/fman/etc/mm.c | |
parent | 191df8fa29e685ce4c3250e6f8ca76599f32f4c3 (diff) | |
download | linux-fsl-qoriq-6337363a3c85f8da8a524a56c32829dbd7ae3433.tar.xz |
fmd: fix static analysis issues
Change-Id: I428d24ec05b1e6ef2137ad2ba6385ddfa3a01872
Signed-off-by: Mandy Lavi <mandy.lavi@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/22882
Reviewed-by: Nir Erez <nir.erez@freescale.com>
Reviewed-by: Matthew Weigel <Matthew.Weigel@freescale.com>
Tested-by: Matthew Weigel <Matthew.Weigel@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/fman/etc/mm.c')
-rw-r--r-- | drivers/net/ethernet/freescale/fman/etc/mm.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/net/ethernet/freescale/fman/etc/mm.c b/drivers/net/ethernet/freescale/fman/etc/mm.c index 7b9d201..9fcc46e 100644 --- a/drivers/net/ethernet/freescale/fman/etc/mm.c +++ b/drivers/net/ethernet/freescale/fman/etc/mm.c @@ -246,6 +246,7 @@ 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; } @@ -575,7 +576,10 @@ 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 ); @@ -617,12 +621,15 @@ 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++) @@ -631,7 +638,10 @@ 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; @@ -754,6 +764,7 @@ 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); } @@ -810,6 +821,7 @@ 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); } @@ -898,6 +910,7 @@ 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); } |