diff options
author | Zane Shelley <zshelle@us.ibm.com> | 2017-02-07 12:56:34 -0600 |
---|---|---|
committer | Zane C. Shelley <zshelle@us.ibm.com> | 2017-02-10 17:34:11 -0500 |
commit | aaacd79d799b9b99ab66505c23fc65b898550874 (patch) | |
tree | cd741390a0810fe972f61761ca8c569241755ab5 /src/usr/diag/prdf/common/plat/prdfTargetServices.C | |
parent | 8ece86143be0b2d8dcc6a8ad46faa88a7e76577a (diff) | |
download | talos-hostboot-aaacd79d799b9b99ab66505c23fc65b898550874.tar.gz talos-hostboot-aaacd79d799b9b99ab66505c23fc65b898550874.zip |
PRD: cleaned error handling for getConnectedParent() functions
The functions will now assert if no parent is found. No need to check
for nullptr anymore.
Change-Id: I40da83f801ab2b47f2e98b7438211d68bea0dcc7
RTC: 168856
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36052
Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com>
Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36079
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Diffstat (limited to 'src/usr/diag/prdf/common/plat/prdfTargetServices.C')
-rwxr-xr-x | src/usr/diag/prdf/common/plat/prdfTargetServices.C | 51 |
1 files changed, 11 insertions, 40 deletions
diff --git a/src/usr/diag/prdf/common/plat/prdfTargetServices.C b/src/usr/diag/prdf/common/plat/prdfTargetServices.C index f08276ecd..c7459e20a 100755 --- a/src/usr/diag/prdf/common/plat/prdfTargetServices.C +++ b/src/usr/diag/prdf/common/plat/prdfTargetServices.C @@ -624,8 +624,6 @@ TargetHandle_t getConnectedParent( TargetHandle_t i_target, TYPE i_connType ) PRDF_ASSERT( nullptr != i_target ); - TargetHandle_t o_parent = NULL; - // Get the association type, must be PARENT_BY_AFFINITY. TargetService::ASSOCIATION_TYPE assocType = getAssociationType( i_target, i_connType); @@ -636,21 +634,16 @@ TargetHandle_t getConnectedParent( TargetHandle_t i_target, TYPE i_connType ) PRDF_ASSERT(false); } - do + // Get the connected parent, should be one and only one parent + TargetHandleList list = getConnAssoc( i_target, i_connType, assocType ); + if ( 1 != list.size() || nullptr == list[0] ) { - TargetHandleList list = getConnAssoc( i_target, i_connType, assocType ); - if ( 1 != list.size() ) // Should be one and only one parent - { - PRDF_ERR( PRDF_FUNC "Could not find parent: i_target=0x%08x " - "i_connType=%d", getHuid(i_target), i_connType ); - break; - } - - o_parent = list[0]; - - } while(0); + PRDF_ERR( PRDF_FUNC "Could not find parent: i_target=0x%08x " + "i_connType=%d", getHuid(i_target), i_connType ); + PRDF_ASSERT(false); + } - return o_parent; + return list[0]; #undef PRDF_FUNC } @@ -849,16 +842,10 @@ ExtensibleChip * getConnectedParent( ExtensibleChip * i_child, { PRDF_ASSERT( nullptr != i_child ); - ExtensibleChip * o_parent = nullptr; - TargetHandle_t trgt = getConnectedParent( i_child->getTrgt(), i_parentType ); - if ( nullptr != trgt ) - { - o_parent = (ExtensibleChip *)systemPtr->GetChip( trgt ); - } - return o_parent; + return (ExtensibleChip *)systemPtr->GetChip( trgt ); } //------------------------------------------------------------------------------ @@ -1192,18 +1179,9 @@ uint32_t getMemChnl( TARGETING::TargetHandle_t i_memTarget ) // INVALID_POSITION_BOUND for call // from getTargetPosition(). - do - { - TargetHandle_t mcsTarget = getConnectedParent( i_memTarget, TYPE_MCS ); - if ( NULL == mcsTarget ) - { - PRDF_ERR( PRDF_FUNC "getConnectedParent() failed" ); - break; - } - - o_chnl = getTargetPosition( mcsTarget ); + TargetHandle_t mcsTarget = getConnectedParent( i_memTarget, TYPE_MCS ); - } while (0); + o_chnl = getTargetPosition( mcsTarget ); if ( MAX_MCS_PER_PROC <= o_chnl ) // Real MCS position check. { @@ -1597,13 +1575,6 @@ TARGETING::TargetHandle_t getClockId(TARGETING::TargetHandle_t if(TYPE_MEMBUF == getTargetType(i_pGivenTarget)) { l_target = getConnectedParent(i_pGivenTarget, TYPE_PROC); - if(NULL == l_target) - { - PRDF_ERR(PRDF_FUNC "failed to get proc target " - "connected to membuf 0x%.8X", - getHuid(l_target)); - break; - } } PredicateIsFunctional l_funcFilter; |