diff options
author | Mandy Lavi <mandy.lavi@freescale.com> | 2014-05-25 15:25:41 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-05-29 15:01:49 (GMT) |
commit | 081a450987752d20158a22eb632814d74460f3e1 (patch) | |
tree | 2b4e57facda8cfb86c096f1a5449225175b27d8e /drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd | |
parent | be88d5881dc082c055b59686dfb0425f791caa58 (diff) | |
download | linux-fsl-qoriq-081a450987752d20158a22eb632814d74460f3e1.tar.xz |
fmd: fix potentially uninitialized pointer
Signed-off-by: Mandy Lavi <mandy.lavi@freescale.com>
Change-Id: I5ef4f9bd5f0cb1d9b43d8bcc4ac7b1efb3b0bd38
Reviewed-on: http://git.am.freescale.net:8181/12856
Reviewed-by: Nir Erez <nir.erez@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Tested-by: Jose Rivera <German.Rivera@freescale.com>
(cherry picked from commit 39967816be45a10552e25ec27e2d20de0a466534)
Reviewed-on: http://git.am.freescale.net:8181/13060
Diffstat (limited to 'drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd')
-rw-r--r-- | drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_cc.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_cc.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_cc.c index 2e6a0e0..09eec69 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_cc.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_cc.c @@ -924,18 +924,16 @@ static t_Error DoDynamicChange(t_Handle h_FmPcd, memset(&nextEngineParams, 0, sizeof(t_FmPcdCcNextEngineParams)); - numOfModifiedPtr = (uint8_t)LIST_NumOfObjs(h_OldPointersLst); - - if (numOfModifiedPtr) - { - - p_PosNew = LIST_FIRST(h_NewPointersLst); - - /* Invoke host-command to copy from the new Ad to existing Ads */ - err = DynamicChangeHc(h_FmPcd, h_OldPointersLst, h_NewPointersLst, p_AdditionalParams, useShadowStructs); - if (err) - RETURN_ERROR(MAJOR, err, NO_MSG); - } + numOfModifiedPtr = (uint8_t)LIST_NumOfObjs(h_OldPointersLst); + + + p_PosNew = LIST_FIRST(h_NewPointersLst); + + /* Invoke host-command to copy from the new Ad to existing Ads */ + err = DynamicChangeHc(h_FmPcd, h_OldPointersLst, h_NewPointersLst, p_AdditionalParams, useShadowStructs); + if (err) + RETURN_ERROR(MAJOR, err, NO_MSG); + if (useShadowStructs) { /* When the host-command above has ended, the old structures are 'free'and we can update @@ -953,25 +951,30 @@ static t_Error DoDynamicChange(t_Handle h_FmPcd, p_AdditionalParams->p_AdTableNew, (uint32_t)((p_CcNode->maxNumOfKeys + 1) * FM_PCD_CC_AD_ENTRY_SIZE)); - /* Retrieve the address of the allocated Ad */ - p_CcNodeInfo = CC_NODE_F_OBJECT(p_PosNew); - h_Ad = p_CcNodeInfo->h_CcNode; - /* Build a new Ad that holds the old (now updated) structures */ p_AdditionalParams->p_KeysMatchTableNew = p_AdditionalParams->p_KeysMatchTableOld; p_AdditionalParams->p_AdTableNew = p_AdditionalParams->p_AdTableOld; - nextEngineParams.nextEngine = e_FM_PCD_CC; - nextEngineParams.params.ccParams.h_CcNode = (t_Handle)p_CcNode; - - BuildNewAd(h_Ad, p_AdditionalParams, p_CcNode, &nextEngineParams); + if (numOfModifiedPtr) + { + /* Retrieve the address of the allocated Ad */ + p_CcNodeInfo = CC_NODE_F_OBJECT(p_PosNew); + h_Ad = p_CcNodeInfo->h_CcNode; + nextEngineParams.nextEngine = e_FM_PCD_CC; + nextEngineParams.params.ccParams.h_CcNode = (t_Handle)p_CcNode; + /* Build a new Ad that holds the old (now updated) structures */ + BuildNewAd(h_Ad, p_AdditionalParams, p_CcNode, &nextEngineParams); + } + /* HC to copy from the new Ad (old updated structures) to current Ad (uses shadow structures) */ err = DynamicChangeHc(h_FmPcd, h_OldPointersLst, h_NewPointersLst, p_AdditionalParams, useShadowStructs); if (err) RETURN_ERROR(MAJOR, err, NO_MSG); } + + err = ReleaseModifiedDataStructure(h_FmPcd, h_OldPointersLst, h_NewPointersLst, |