Fixed Klocwork C code checker errors
authorSunil MS <x0190988@ti.com>
Mon, 29 Sep 2014 14:07:41 +0000 (19:37 +0530)
committerSunil MS <x0190988@ti.com>
Thu, 9 Oct 2014 14:11:34 +0000 (19:41 +0530)
Fixed Klocwaork static analysis c code checker errors which were critical.

Null pointer dereference
Unreachable code

Change-Id: Icf7dc3440fdd44c14dfe851f0592ec98f67797e6
Signed-off-by: Sunil MS <x0190988@ti.com>
packages/ti/sdo/edma3/drv/src/edma3_drv_adv.c
packages/ti/sdo/edma3/drv/src/edma3_drv_basic.c
packages/ti/sdo/edma3/rm/src/edma3resmgr.c

index 258758968c498802f5942193fb2b3a579347a575..931b647efe2dfe3dd86596988167efb63e4e63ca 100755 (executable)
@@ -201,6 +201,8 @@ EDMA3_DRV_Result EDMA3_DRV_linkChannel (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (EDMA3_DRV_SOK == result)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if ((lCh1 > edma3_log_ch_max_val [edma3Id])
@@ -209,6 +211,7 @@ EDMA3_DRV_Result EDMA3_DRV_linkChannel (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
@@ -313,6 +316,8 @@ EDMA3_DRV_Result EDMA3_DRV_unlinkChannel (EDMA3_DRV_Handle hEdma, uint32_t lCh)
                }
                }
 
+    if (EDMA3_DRV_SOK == result)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -320,6 +325,7 @@ EDMA3_DRV_Result EDMA3_DRV_unlinkChannel (EDMA3_DRV_Handle hEdma, uint32_t lCh)
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
@@ -404,6 +410,8 @@ EDMA3_DRV_Result EDMA3_DRV_chainChannel (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (EDMA3_DRV_SOK == result)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if ((lCh1 > edma3_log_ch_max_val [edma3Id])
@@ -412,6 +420,7 @@ EDMA3_DRV_Result EDMA3_DRV_chainChannel (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
@@ -530,6 +539,8 @@ EDMA3_DRV_Result EDMA3_DRV_unchainChannel (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (result == EDMA3_DRV_SOK)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -537,7 +548,8 @@ EDMA3_DRV_Result EDMA3_DRV_unchainChannel (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
+    }
+       
        if (EDMA3_DRV_SOK == result)
         {
         paRAMId = edma3DrvChBoundRes[edma3Id][lCh].paRAMId;
@@ -615,6 +627,8 @@ EDMA3_DRV_Result EDMA3_DRV_setQdmaTrigWord (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (result == EDMA3_DRV_SOK)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if ((lCh < edma3_qdma_ch_min_val[edma3Id])
@@ -623,6 +637,7 @@ EDMA3_DRV_Result EDMA3_DRV_setQdmaTrigWord (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
@@ -686,6 +701,8 @@ EDMA3_DRV_Result EDMA3_DRV_setPaRAM (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (result == EDMA3_DRV_SOK)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -693,7 +710,7 @@ EDMA3_DRV_Result EDMA3_DRV_setPaRAM (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
+    }
        if (EDMA3_DRV_SOK == result)
         {
         paRAMId = edma3DrvChBoundRes[edma3Id][lCh].paRAMId;
@@ -763,6 +780,8 @@ EDMA3_DRV_Result EDMA3_DRV_getPaRAM (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (result == EDMA3_DRV_SOK)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -770,7 +789,7 @@ EDMA3_DRV_Result EDMA3_DRV_getPaRAM (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
+    }
        if (EDMA3_DRV_SOK == result)
         {
         paRAMId = edma3DrvChBoundRes[edma3Id][lCh].paRAMId;
@@ -844,6 +863,8 @@ EDMA3_DRV_Result EDMA3_DRV_setPaRAMEntry (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (result == EDMA3_DRV_SOK)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -851,8 +872,8 @@ EDMA3_DRV_Result EDMA3_DRV_setPaRAMEntry (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
-       if (EDMA3_DRV_SOK == result)
+    }
+    if (EDMA3_DRV_SOK == result)
         {
         paRAMId = edma3DrvChBoundRes[edma3Id][lCh].paRAMId;
         if ((paRAMId < 0) || (paRAMId >= drvObject->gblCfgParams.numPaRAMSets))
@@ -928,6 +949,8 @@ EDMA3_DRV_Result EDMA3_DRV_getPaRAMEntry (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (result == EDMA3_DRV_SOK)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -935,8 +958,9 @@ EDMA3_DRV_Result EDMA3_DRV_getPaRAMEntry (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
-       if (EDMA3_DRV_SOK == result)
+    }
+       
+    if (EDMA3_DRV_SOK == result)
         {
         paRAMId = edma3DrvChBoundRes[edma3Id][lCh].paRAMId;
         if ((paRAMId < 0) || (paRAMId >= drvObject->gblCfgParams.numPaRAMSets))
@@ -1008,6 +1032,8 @@ EDMA3_DRV_Result EDMA3_DRV_setPaRAMField (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (result == EDMA3_DRV_SOK)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     /*
@@ -1028,6 +1054,7 @@ EDMA3_DRV_Result EDMA3_DRV_setPaRAMField (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
@@ -1190,6 +1217,8 @@ EDMA3_DRV_Result EDMA3_DRV_getPaRAMField (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (result == EDMA3_DRV_SOK)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -1197,7 +1226,8 @@ EDMA3_DRV_Result EDMA3_DRV_getPaRAMField (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
+    }
+       
        if (EDMA3_DRV_SOK == result)
         {
         paRAMId = edma3DrvChBoundRes[edma3Id][lCh].paRAMId;
@@ -1422,6 +1452,8 @@ EDMA3_DRV_Result EDMA3_DRV_mapChToEvtQ(EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (result == EDMA3_DRV_SOK)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (channelId > edma3_log_ch_max_val [edma3Id])
@@ -1429,13 +1461,17 @@ EDMA3_DRV_Result EDMA3_DRV_mapChToEvtQ(EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 
+    }
+
+    if (result == EDMA3_DRV_SOK)
+    {
     /* Check the event queue */
     if (eventQ >= drvObject->gblCfgParams.numEvtQueue)
         {
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
+    }
     if (result == EDMA3_DRV_SOK)
         {
         if (channelId <= edma3_dma_ch_max_val [edma3Id])
@@ -1959,6 +1995,8 @@ EDMA3_DRV_Result EDMA3_DRV_getPaRAMPhyAddr(EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (result == EDMA3_DRV_SOK)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -1966,6 +2004,7 @@ EDMA3_DRV_Result EDMA3_DRV_getPaRAMPhyAddr(EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
@@ -2132,8 +2171,11 @@ EDMA3_DRV_Handle EDMA3_DRV_getInstHandle(uint32_t phyCtrllerInstId,
             result = EDMA3_DRV_E_INST_NOT_OPENED;
             }
                }
+    if(errorCode != NULL)
+    {
+        *errorCode = result;
+    }
 
-       *errorCode = result;
        return (EDMA3_DRV_Handle)drvInstanceHandle;
        }
 
@@ -2465,6 +2507,8 @@ EDMA3_DRV_Result EDMA3_DRV_getChannelStatus(EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (result == EDMA3_DRV_SOK)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -2479,6 +2523,7 @@ EDMA3_DRV_Result EDMA3_DRV_getChannelStatus(EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
index b3c798ccb4a1b713c14e890e72219d578d304114..5d5123003921073bda05cb56264f14f00922acbd 100755 (executable)
@@ -183,7 +183,7 @@ EDMA3_DRV_Result EDMA3_DRV_requestChannel (EDMA3_DRV_Handle hEdma,
     EDMA3_DRV_Object *drvObject = NULL;
     uint32_t mappedTcc = EDMA3_DRV_CH_NO_TCC_MAP;
     int32_t paRAMId = (int32_t)EDMA3_RM_RES_ANY;
-    EDMA3_DRV_ChannelType chType = EDMA3_DRV_CHANNEL_TYPE_QDMA;
+    EDMA3_DRV_ChannelType chType = EDMA3_DRV_CHANNEL_TYPE_NONE;
     volatile EDMA3_CCRL_Regs *globalRegs = NULL;
     int32_t mappedPaRAMId;
        uint32_t edma3Id;
@@ -218,23 +218,25 @@ EDMA3_DRV_Result EDMA3_DRV_requestChannel (EDMA3_DRV_Handle hEdma,
             result = EDMA3_DRV_E_INVALID_PARAM;
             }
                }
-
-    if ( drvInst->mapXbarToChan != NULL)
+    if (EDMA3_DRV_SOK == result)
         {
-        xBarEvtBeforeMap = *pLCh;
-        edma3Id = drvObject->phyCtrllerInstId;
-        if ((xBarEvtBeforeMap > edma3_dma_ch_max_val [edma3Id]) &&
-               (xBarEvtBeforeMap < EDMA3_DRV_DMA_CHANNEL_ANY) && 
-               ((*pLCh) == (*pTcc)))
-            {
-            result = drvInst->mapXbarToChan(xBarEvtBeforeMap, 
-                               pLCh, 
-                               &drvInst->drvXbarToEvtMapConfig);
-                       if (EDMA3_DRV_SOK == result)
-                               {
-                               *pTcc = *pLCh;
-                               mapXbarEvtToChanFlag = TRUE;
-                               }
+            if ( drvInst->mapXbarToChan != NULL)
+                {
+                    xBarEvtBeforeMap = *pLCh;
+                    edma3Id = drvObject->phyCtrllerInstId;
+                    if ((xBarEvtBeforeMap > edma3_dma_ch_max_val [edma3Id]) &&
+                        (xBarEvtBeforeMap < EDMA3_DRV_DMA_CHANNEL_ANY) && 
+                        ((*pLCh) == (*pTcc)))
+                        {
+                        result = drvInst->mapXbarToChan(xBarEvtBeforeMap, 
+                                    pLCh, 
+                                    &drvInst->drvXbarToEvtMapConfig);
+                        if (EDMA3_DRV_SOK == result)
+                            {
+                            *pTcc = *pLCh;
+                            mapXbarEvtToChanFlag = TRUE;
+                            }
+                }
             }
         }
 
@@ -630,11 +632,15 @@ EDMA3_DRV_Result EDMA3_DRV_requestChannel (EDMA3_DRV_Handle hEdma,
                        result = EDMA3_DRV_E_TCC_UNAVAIL;
                        }
                }
+
+        if (EDMA3_DRV_SOK == result)
+        {
                if ((drvInst->configScrMapXbarToEvt != NULL) && 
                        (mapXbarEvtToChanFlag == TRUE))
                        {
                        drvInst->configScrMapXbarToEvt(xBarEvtBeforeMap, *pLCh);
                        }
+        }
 
 #ifdef EDMA3_INSTRUMENTATION_ENABLED
     EDMA3_LOG_EVENT(&DVTEvent_Log,"EDMA3",
@@ -966,6 +972,8 @@ EDMA3_DRV_Result EDMA3_DRV_setOptField (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (EDMA3_DRV_SOK == result)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -973,7 +981,8 @@ EDMA3_DRV_Result EDMA3_DRV_setOptField (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
+    }
+       
        if (EDMA3_DRV_SOK == result)
         {
         paRAMId = edma3DrvChBoundRes[edma3Id][lCh].paRAMId;
@@ -1110,6 +1119,8 @@ EDMA3_DRV_Result EDMA3_DRV_getOptField (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (EDMA3_DRV_SOK == result)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -1117,6 +1128,7 @@ EDMA3_DRV_Result EDMA3_DRV_getOptField (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
@@ -1241,6 +1253,8 @@ EDMA3_DRV_Result EDMA3_DRV_setSrcParams (EDMA3_DRV_Handle hEdma,
                }
                }
 
+       if (EDMA3_DRV_SOK == result)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -1248,6 +1262,7 @@ EDMA3_DRV_Result EDMA3_DRV_setSrcParams (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
@@ -1386,6 +1401,8 @@ EDMA3_DRV_Result EDMA3_DRV_setDestParams (EDMA3_DRV_Handle hEdma,
                }
                }
 
+       if (EDMA3_DRV_SOK == result)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -1393,7 +1410,8 @@ EDMA3_DRV_Result EDMA3_DRV_setDestParams (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
+    }
+       
        if (EDMA3_DRV_SOK == result)
         {
         paRAMId = edma3DrvChBoundRes[edma3Id][lCh].paRAMId;
@@ -1526,6 +1544,8 @@ EDMA3_DRV_Result EDMA3_DRV_setSrcIndex (EDMA3_DRV_Handle hEdma,
                }
                }
 
+       if (EDMA3_DRV_SOK == result)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -1533,6 +1553,7 @@ EDMA3_DRV_Result EDMA3_DRV_setSrcIndex (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
@@ -1633,6 +1654,8 @@ EDMA3_DRV_Result  EDMA3_DRV_setDestIndex (EDMA3_DRV_Handle hEdma, uint32_t lCh,
                }
                }
 
+       if (EDMA3_DRV_SOK == result)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -1640,6 +1663,7 @@ EDMA3_DRV_Result  EDMA3_DRV_setDestIndex (EDMA3_DRV_Handle hEdma, uint32_t lCh,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
@@ -1743,6 +1767,8 @@ EDMA3_DRV_Result EDMA3_DRV_setTransferParams (EDMA3_DRV_Handle hEdma,
                }
                }
 
+       if (EDMA3_DRV_SOK == result)
+    {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -1750,6 +1776,7 @@ EDMA3_DRV_Result EDMA3_DRV_setTransferParams (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
+    }
 
        if (EDMA3_DRV_SOK == result)
         {
@@ -1843,6 +1870,8 @@ EDMA3_DRV_Result EDMA3_DRV_enableTransfer (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (EDMA3_DRV_SOK == result)
+        {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -1876,7 +1905,8 @@ EDMA3_DRV_Result EDMA3_DRV_enableTransfer (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
+        }
+               
        if (EDMA3_DRV_SOK == result)
         {
         switch (trigMode)
@@ -1990,7 +2020,8 @@ EDMA3_DRV_Result EDMA3_DRV_disableTransfer (EDMA3_DRV_Handle hEdma,
             globalRegs = (volatile EDMA3_CCRL_Regs *)(drvObject->gblCfgParams.globalRegs);
                }
                }
-
+       if (EDMA3_DRV_SOK == result)
+        {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -2024,7 +2055,8 @@ EDMA3_DRV_Result EDMA3_DRV_disableTransfer (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
+        }
+               
        if (EDMA3_DRV_SOK == result)
         {
         switch (trigMode)
@@ -2160,6 +2192,8 @@ EDMA3_DRV_Result EDMA3_DRV_disableLogicalChannel (EDMA3_DRV_Handle hEdma,
                }
                }
 
+    if (EDMA3_DRV_SOK == result)
+        {
        /* If parameter checking is enabled... */
 #ifndef EDMA3_DRV_PARAM_CHECK_DISABLE
     if (lCh > edma3_log_ch_max_val [edma3Id])
@@ -2185,7 +2219,8 @@ EDMA3_DRV_Result EDMA3_DRV_disableLogicalChannel (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_E_INVALID_PARAM;
         }
 #endif
-
+        }
+               
        if (EDMA3_DRV_SOK == result)
         {
         switch (trigMode)
@@ -2255,8 +2290,13 @@ static EDMA3_DRV_Result edma3RemoveMapping (EDMA3_DRV_Handle hEdma,
                                 (drvObject->gblCfgParams.globalRegs);
        }
 
-       assert (channelId <= edma3_log_ch_max_val [edma3Id]);
+    if (EDMA3_DRV_SOK == result)
+    {
+        assert (channelId <= edma3_log_ch_max_val [edma3Id]);
+    }
 
+    if (EDMA3_DRV_SOK == result)
+    {
 
     /**
      * Disable any ongoing transfer on the channel, if transfer was
@@ -2268,7 +2308,8 @@ static EDMA3_DRV_Result edma3RemoveMapping (EDMA3_DRV_Handle hEdma,
         result = EDMA3_DRV_disableTransfer(hEdma, channelId,
             edma3DrvChBoundRes[edma3Id][channelId].trigMode);
         }
-
+    }
+       
     if (EDMA3_DRV_SOK == result)
         {
         /*
index 186d7e48499ef4a6bb5751a802f7730ba19fc4ec..d31b4ff37210148dbe16be9df37c4b403f3dfec3 100755 (executable)
@@ -951,7 +951,10 @@ EDMA3_RM_Handle EDMA3_RM_open (uint32_t phyCtrllerInstId,
             }
         }
 
-    *errorCode = result;
+    if(errorCode != NULL)
+    {
+        *errorCode = result;
+    }
     return (EDMA3_RM_Handle)retVal;
     }
 
@@ -5299,14 +5302,17 @@ static void edma3ComplHandler (const EDMA3_RM_Obj *rmObj)
     indexl = 1U;
     indexh = 1U;
 
-    if (numTCCs > 32U)
+    if(shadowRegs != NULL)
     {
-       isIPR = shadowRegs->IPR | shadowRegs->IPRH;
-    }
-       else
-    {
-       isIPR = shadowRegs->IPR;
-    }
+        if (numTCCs > 32U)
+        {
+            isIPR = shadowRegs->IPR | shadowRegs->IPRH;
+        }
+        else
+        {
+        isIPR = shadowRegs->IPR;
+        }
+
     if(isIPR)
         {
         /**
@@ -5414,6 +5420,7 @@ static void edma3ComplHandler (const EDMA3_RM_Obj *rmObj)
                                                        (int32_t)EDMA3_OS_PROTECT_INTERRUPT_XFER_COMPLETION,
                                                        0);
         }
+    }
 
 #ifdef EDMA3_INSTRUMENTATION_ENABLED
     EDMA3_LOG_EVENT(&DVTEvent_Log,"EDMA3",
@@ -5856,7 +5863,9 @@ static void edma3TCErrHandler (const EDMA3_RM_Obj *rmObj, uint32_t tcNum)
                 EDMA3_DVT_dNONE));
 #endif /* EDMA3_INSTRUMENTATION_ENABLED */
 
-    assert ((rmObj != NULL) && (tcNum < rmObj->gblCfgParams.numTcs));
+    assert (rmObj != NULL);
+
+    assert (tcNum < rmObj->gblCfgParams.numTcs);
 
     if (rmObj->gblCfgParams.tcRegs[tcNum] != NULL)
         {
@@ -6173,10 +6182,12 @@ static void edma3ShadowRegionInit (const EDMA3_RM_Instance *pRMInstance)
     volatile EDMA3_CCRL_ShadowRegs *ptrEdmaShadowRegs   = NULL;
     uint32_t phyCtrllerInstId;
     uint32_t regionId;
-    const EDMA3_RM_InstanceInitConfig *rmInstInitConfig = pRMInstance->initParam.rmInstInitConfig;
+    const EDMA3_RM_InstanceInitConfig *rmInstInitConfig = NULL;
 
     assert (pRMInstance != NULL);
 
+    rmInstInitConfig = pRMInstance->initParam.rmInstInitConfig;
+
     if (rmInstInitConfig != NULL)
         {
         phyCtrllerInstId = pRMInstance->pResMgrObjHandle->phyCtrllerInstId;
@@ -6263,7 +6274,9 @@ void edma3MemCpy(void *dst, const void *src, uint32_t len)
     const uint32_t *sr;
     uint32_t *ds;
 
-    assert ((src != NULL) && (dst != NULL) && ((len%4) == 0));
+    assert (src != NULL);
+    assert (dst != NULL);
+    assert ((len%4) == 0);
 
     sr = (const uint32_t *)src;
     ds = (uint32_t *)dst;
@@ -6286,7 +6299,8 @@ void edma3ParamCpy(volatile void *dst, const volatile void *src)
     const volatile uint32_t *sr;
     volatile uint32_t *ds;
 
-    assert ((src != NULL) && (dst != NULL));
+    assert (src != NULL);
+    assert (dst != NULL);
 
     sr = (const volatile uint32_t *)src;
     ds = (volatile uint32_t *)dst;
@@ -6652,7 +6666,8 @@ static EDMA3_RM_Result gblChngAllocContigRes(EDMA3_RM_Instance *rmInstance,
     uint32_t lastResId=0U;
        uint32_t edma3Id;
 
-    assert ((rmInstance != NULL) && (firstResIdObj != NULL));
+    assert (rmInstance != NULL);
+    assert (firstResIdObj != NULL);
 
     rmObj = rmInstance->pResMgrObjHandle;