summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/fman/etc
diff options
context:
space:
mode:
authorMandy Lavi <mandy.lavi@freescale.com>2014-11-19 05:17:46 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:40:48 (GMT)
commitca6d6c8930a031eeab8e121ae7de52dede339e21 (patch)
treea102319534e49b7624b67a40a3d906662ce5850b /drivers/net/ethernet/freescale/fman/etc
parent5676273b1553c5920c90592f49a1d8fce560f24d (diff)
downloadlinux-fsl-qoriq-ca6d6c8930a031eeab8e121ae7de52dede339e21.tar.xz
fmd: fix static analysis issues
Change-Id: I2d6cead7b62116cd6a264ec91d82f3bdc3a03c10 Signed-off-by: Mandy Lavi <mandy.lavi@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/23939 Reviewed-by: Igal Liberman <Igal.Liberman@freescale.com> Tested-by: Richard Schmitt <richard.schmitt@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/fman/etc')
-rw-r--r--drivers/net/ethernet/freescale/fman/etc/mm.c19
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);
}