diff options
author | Caleb Palmer <cnpalmer@us.ibm.com> | 2018-03-02 15:06:13 -0600 |
---|---|---|
committer | Zane C. Shelley <zshelle@us.ibm.com> | 2018-03-06 15:40:29 -0500 |
commit | d2fd055febb7951474bffd527cc88e189a866ee3 (patch) | |
tree | 2c59d50e3653c248777f6b048514dff4e6d9c357 /src/usr/fapi2/attribute_service.C | |
parent | 18a73baccdc224201d38f73d5000e1f88f1bd52d (diff) | |
download | talos-hostboot-d2fd055febb7951474bffd527cc88e189a866ee3.tar.gz talos-hostboot-d2fd055febb7951474bffd527cc88e189a866ee3.zip |
Free mem and fix dimm trgt in bad dq accessors
Change-Id: I8db862122b9bab7eae2e75a4188c863704e9fdcd
CQ: SW419983
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/54996
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com>
Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com>
Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2/attribute_service.C')
-rw-r--r-- | src/usr/fapi2/attribute_service.C | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/usr/fapi2/attribute_service.C b/src/usr/fapi2/attribute_service.C index 1089f97e4..dfcaff74a 100644 --- a/src/usr/fapi2/attribute_service.C +++ b/src/usr/fapi2/attribute_service.C @@ -695,11 +695,10 @@ errlHndl_t __dimmUpdateDqBitmapEccByte( const uint8_t ECC_DQ_BYTE_NUMBER_INDEX = 8; const uint8_t ENUM_ATTR_SPD_MODULE_MEMORY_BUS_WIDTH_WE8 = 0x08; size_t MEM_BUS_WIDTH_SIZE = 0x01; + uint8_t *l_eccBits = static_cast<uint8_t*>(malloc(MEM_BUS_WIDTH_SIZE)); do { - uint8_t *l_eccBits = static_cast<uint8_t*>(malloc(MEM_BUS_WIDTH_SIZE)); - l_errl = deviceRead( i_dimm, l_eccBits, MEM_BUS_WIDTH_SIZE, @@ -729,6 +728,12 @@ errlHndl_t __dimmUpdateDqBitmapEccByte( } }while(0); + if ( l_eccBits != nullptr ) + { + free( l_eccBits ); + l_eccBits = nullptr; + } + return l_errl; } @@ -1222,6 +1227,9 @@ ReturnCode fapiAttrGetBadDqBitmap( errlHndl_t l_errl = nullptr; TARGETING::TargetHandle_t l_dimmTarget = nullptr; + uint8_t * l_badDqData = + static_cast<uint8_t*>( malloc(DIMM_BAD_DQ_SIZE_BYTES) ); + do { l_errl = getTargetingTarget( i_dimmFapiTarget, l_dimmTarget ); @@ -1245,9 +1253,6 @@ ReturnCode fapiAttrGetBadDqBitmap( break; } - uint8_t * l_badDqData = - static_cast<uint8_t*>( malloc(DIMM_BAD_DQ_SIZE_BYTES) ); - l_errl = deviceRead(l_dimmTarget, l_badDqData, DIMM_BAD_DQ_SIZE_BYTES, DEVICE_SPD_ADDRESS(SPD::DIMM_BAD_DQ_DATA)); @@ -1363,6 +1368,12 @@ ReturnCode fapiAttrGetBadDqBitmap( }while(0); + if ( l_badDqData != nullptr ) + { + free( l_badDqData ); + l_badDqData = nullptr; + } + return l_rc; } @@ -1376,7 +1387,8 @@ ReturnCode fapiAttrSetBadDqBitmap( fapi2::ReturnCode l_rc; errlHndl_t l_errl = nullptr; TARGETING::TargetHandle_t l_dimmTarget = nullptr; - + uint8_t * l_badDqData = + static_cast<uint8_t*>( malloc(DIMM_BAD_DQ_SIZE_BYTES) ); do { l_errl = getTargetingTarget(i_dimmFapiTarget, l_dimmTarget); @@ -1507,9 +1519,6 @@ ReturnCode fapiAttrSetBadDqBitmap( // We need to make sure the rest of the data in VPD beyond the bad dq // bitmap is unchanged. - uint8_t * l_badDqData = - static_cast<uint8_t*>( malloc(DIMM_BAD_DQ_SIZE_BYTES) ); - l_errl = deviceRead(l_dimmTarget, l_badDqData, DIMM_BAD_DQ_SIZE_BYTES, DEVICE_SPD_ADDRESS(SPD::DIMM_BAD_DQ_DATA)); @@ -1560,6 +1569,12 @@ ReturnCode fapiAttrSetBadDqBitmap( }while(0); + if ( l_badDqData != nullptr ) + { + free( l_badDqData ); + l_badDqData = nullptr; + } + return l_rc; } |