summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorChristian Geddes <crgeddes@us.ibm.com>2017-09-08 10:22:52 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-09-25 11:54:57 -0400
commit1b3b999258db544d6af1dbfb7ee3437efd17581b (patch)
tree1cb96dd1838af832ef630398c93cfedeaafda3ef /src/usr
parentac058e9b3c6d1d5d57089d42cbb75b76f36d24a2 (diff)
downloadtalos-hostboot-1b3b999258db544d6af1dbfb7ee3437efd17581b.tar.gz
talos-hostboot-1b3b999258db544d6af1dbfb7ee3437efd17581b.zip
Set variables to nullptr after they are deleted
While updating some LPC logic a developer noticed a bug where an errlog handle wasnt getting set to nullptr after it was deleted this caused a confusing bug that took awhile to track. I noticed that this bug was all over our code so this commit fixes a lot of cases where variables get deleted but not set to nullptr Change-Id: I103b5c71b93686c3c89b04d1d565a24d4de74e6f Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/45890 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Matt Derksen <mderkse1@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/errl/errlmanager_common.C2
-rw-r--r--src/usr/errl/errludlogregister.C5
-rw-r--r--src/usr/hdat/hdatutil.C2
-rwxr-xr-xsrc/usr/i2c/i2c.C1
-rw-r--r--src/usr/initservice/istepdispatcher/istepdispatcher.C1
-rw-r--r--src/usr/intr/intrrp.C6
-rw-r--r--src/usr/ipmi/ipmifruinv.C2
-rw-r--r--src/usr/ipmi/ipmisensor.C1
-rw-r--r--src/usr/pnor/ast_mboxdd.C1
-rw-r--r--src/usr/pnor/nor_micron.C9
-rw-r--r--src/usr/pnor/sfc_ast2X00.C3
-rw-r--r--src/usr/pnor/sfc_ibm.C3
-rw-r--r--src/usr/runtime/hdatservice.C4
-rw-r--r--src/usr/sbeio/sbe_psudd.C3
-rw-r--r--src/usr/scom/scom.C2
-rw-r--r--src/usr/targeting/runtime/attrPlatOverride_rt.C1
-rw-r--r--src/usr/util/runtime/rt_cmds.C1
-rw-r--r--src/usr/vfs/vfsrp.C1
-rw-r--r--src/usr/xscom/xscom.C2
19 files changed, 40 insertions, 10 deletions
diff --git a/src/usr/errl/errlmanager_common.C b/src/usr/errl/errlmanager_common.C
index e69036195..8bd058fac 100644
--- a/src/usr/errl/errlmanager_common.C
+++ b/src/usr/errl/errlmanager_common.C
@@ -177,6 +177,7 @@ void ErrlManager::setupPnorInfo()
sendErrLogToBmc(err,
false /* do not resend SELs */);
delete err;
+ err = nullptr;
}
else
{
@@ -724,6 +725,7 @@ void ErrlManager::sendErrLogToBmc(errlHndl_t &io_err, bool i_sendSels)
l_sensorType[j] = 0;
delete l_errl;
+ l_errl = nullptr;
}
// this call will modify the sensor if any procedure
diff --git a/src/usr/errl/errludlogregister.C b/src/usr/errl/errludlogregister.C
index 77e385dbb..43742605b 100644
--- a/src/usr/errl/errludlogregister.C
+++ b/src/usr/errl/errludlogregister.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -184,12 +184,13 @@ void ErrlUserDetailsLogRegister::readRegister(
&reg_data, reg_size,
(DeviceFW::AccessType) i_accessType, i_args);
- if (unlikely(errl != NULL))
+ if (unlikely(errl != nullptr))
{ // error!
TRACFCOMP(g_trac_errl, "LogRegister: deviceOpValist type %d"
" threw errl! deleting errl.",
i_accessType);
delete errl; // eat the error - just delete it
+ errl = nullptr;
// nothing gets written out
}
diff --git a/src/usr/hdat/hdatutil.C b/src/usr/hdat/hdatutil.C
index 1f3a3220f..5ac440ad6 100644
--- a/src/usr/hdat/hdatutil.C
+++ b/src/usr/hdat/hdatutil.C
@@ -970,6 +970,7 @@ errlHndl_t hdatGetAsciiKwdForMvpd(TARGETING::Target * i_target,
theRecord,theKeyword,theSize,curCmd);
delete err;
+ err = nullptr;
if ( NULL != theData )
{
@@ -1106,6 +1107,7 @@ errlHndl_t hdatGetMvpdFullRecord(TARGETING::Target * i_target,
theRecord,theSize,curRec);
delete err;
+ err = nullptr;
if ( NULL != theData )
{
diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C
index 17f5d258d..762d66ec2 100755
--- a/src/usr/i2c/i2c.C
+++ b/src/usr/i2c/i2c.C
@@ -4143,6 +4143,7 @@ void getDeviceInfo( TARGETING::Target* i_i2cMaster,
{
// Unable to get info, so we skip
delete l_err;
+ l_err = nullptr;
continue;
}
// ignore the devices that aren't on the current target
diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C
index 520270be4..8d330847f 100644
--- a/src/usr/initservice/istepdispatcher/istepdispatcher.C
+++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C
@@ -484,6 +484,7 @@ errlHndl_t IStepDispatcher::executeAllISteps()
if (ISTEP::RC_FAILURE == err->reasonCode())
{
delete err;
+ err = nullptr;
}
else
{
diff --git a/src/usr/intr/intrrp.C b/src/usr/intr/intrrp.C
index 155418fde..cc9a18ba1 100644
--- a/src/usr/intr/intrrp.C
+++ b/src/usr/intr/intrrp.C
@@ -1853,6 +1853,7 @@ void IntrRp::shutDown(uint64_t i_status)
if (l_err)
{
delete l_err; //errl comp already shutdown. Log error and continue
+ l_err = nullptr;
TRACFCOMP(g_trac_intr, "IntrRp::shutDown() Error masking all interrupt sources.");
}
@@ -1873,6 +1874,7 @@ void IntrRp::shutDown(uint64_t i_status)
if (l_err)
{
delete l_err;
+ l_err = nullptr;
TRACFCOMP(g_trac_intr, "IntrRp::shutDown() Error re-enabling VPC Pull Err");
}
//Disable common interrupt BARs
@@ -1881,6 +1883,7 @@ void IntrRp::shutDown(uint64_t i_status)
if (l_err)
{
delete l_err; //errl cmp already shutdown. Log error + continue
+ l_err = nullptr;
TRACFCOMP(g_trac_intr, "IntrRp::shutDown() Error disabling Common Interrupt BARs");
}
}
@@ -1899,6 +1902,7 @@ void IntrRp::shutDown(uint64_t i_status)
if (l_err)
{
delete l_err;
+ l_err = nullptr;
TRACFCOMP(g_trac_intr, "IntrRp::shutDown() Error re-enabling VPC Pull Err");
}
@@ -1907,6 +1911,7 @@ void IntrRp::shutDown(uint64_t i_status)
if (l_err)
{
delete l_err; //errl cmp already shutdown. Log error + continue
+ l_err = nullptr;
TRACFCOMP(g_trac_intr, "IntrRp::shutDown() Error disabling Common"
" Interrupt BARs for master proc");
}
@@ -1917,6 +1922,7 @@ void IntrRp::shutDown(uint64_t i_status)
if (l_err)
{
delete l_err; //errl cmp already shutdown. Log error + continue
+ l_err = nullptr;
TRACFCOMP(g_trac_intr, "IntrRp::shutDown() Error disabling Master Interrupt BARs");
}
diff --git a/src/usr/ipmi/ipmifruinv.C b/src/usr/ipmi/ipmifruinv.C
index 8903535a8..bbdb0f95e 100644
--- a/src/usr/ipmi/ipmifruinv.C
+++ b/src/usr/ipmi/ipmifruinv.C
@@ -501,6 +501,7 @@ void IpmiFruInv::setMfgData(std::vector<uint8_t> &io_data,
io_data.push_back(0);
io_data.push_back(0);
delete l_errl;
+ l_errl = nullptr;
}
else
{
@@ -1668,6 +1669,7 @@ void IPMIFRUINV::setData(bool i_updateData)
l_fruId, l_curFru.size());
l_fru->sendFruData(l_fruId);
delete l_fru;
+ l_fru = nullptr;
}
}
diff --git a/src/usr/ipmi/ipmisensor.C b/src/usr/ipmi/ipmisensor.C
index 5be1dc1af..c5d8ef345 100644
--- a/src/usr/ipmi/ipmisensor.C
+++ b/src/usr/ipmi/ipmisensor.C
@@ -1394,6 +1394,7 @@ namespace SENSOR
if (l_errl || (L_obus_cfgID_bit == 0))
{
delete l_errl;
+ l_errl = nullptr;
// default to full list of GPU sensors
L_obus_cfgID_bit = NVCFG_ALL_SENSORS_RETURNED;
}
diff --git a/src/usr/pnor/ast_mboxdd.C b/src/usr/pnor/ast_mboxdd.C
index a515a81a9..df9b6c991 100644
--- a/src/usr/pnor/ast_mboxdd.C
+++ b/src/usr/pnor/ast_mboxdd.C
@@ -168,6 +168,7 @@ errlHndl_t astMbox::doMessage(mboxMessage& io_msg)
// memory leak. Let error below be the one committed.
TRACFCOMP( g_trac_pnor, "Error communicating with MBOX daemon");
delete l_err;
+ l_err = nullptr;
}
/*@
diff --git a/src/usr/pnor/nor_micron.C b/src/usr/pnor/nor_micron.C
index fc0d1197d..cb0fdedb5 100644
--- a/src/usr/pnor/nor_micron.C
+++ b/src/usr/pnor/nor_micron.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2015 */
+/* Contributors Listed Below - COPYRIGHT 2014,2017 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
@@ -51,7 +51,7 @@ errlHndl_t micronCheckForWorkarounds( SfcDD* i_sfc,
// HW workaround - run this command before reading out chipid
l_err = micronFlagStatus( i_sfc );
- if(l_err) { delete l_err; }
+ if(l_err) { delete l_err; l_err = nullptr; }
uint32_t outdata[4];
@@ -78,7 +78,7 @@ errlHndl_t micronCheckForWorkarounds( SfcDD* i_sfc,
//Prove this works
l_err = micronFlagStatus( i_sfc );
- if(l_err) { delete l_err; }
+ if(l_err) { delete l_err; l_err = nullptr; }
} while(0);
@@ -121,7 +121,7 @@ errlHndl_t micronFlagStatus( SfcDD* i_sfc )
SfcDD::NO_ADDRESS,
0, NULL,
6, reinterpret_cast<uint8_t*>(outdata) );
- if( l_err ) { delete l_err; }
+ if( l_err ) { delete l_err; l_err = nullptr; }
/*@
* @errortype
@@ -157,6 +157,7 @@ errlHndl_t micronFlagStatus( SfcDD* i_sfc )
if( l_err )
{
delete l_err;
+ l_err = nullptr;
}
else
{
diff --git a/src/usr/pnor/sfc_ast2X00.C b/src/usr/pnor/sfc_ast2X00.C
index 4efededb4..b976a7cc6 100644
--- a/src/usr/pnor/sfc_ast2X00.C
+++ b/src/usr/pnor/sfc_ast2X00.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -559,6 +559,7 @@ void SfcAST2X00::addFFDC( errlHndl_t& io_errhdl )
if( l_err )
{
delete l_err;
+ l_err = nullptr;
}
else
{
diff --git a/src/usr/pnor/sfc_ibm.C b/src/usr/pnor/sfc_ibm.C
index a13a378f5..24ea7eb9c 100644
--- a/src/usr/pnor/sfc_ibm.C
+++ b/src/usr/pnor/sfc_ibm.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2016 */
+/* Contributors Listed Below - COPYRIGHT 2014,2017 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
@@ -861,6 +861,7 @@ errlHndl_t SfcIBM::checkForErrors( ResetLevels &o_resetLevel )
{
TRACFCOMP( g_trac_pnor, ERR_MRK"SfcIBM::checkForErrors> Deleting register read error. Returning error created for the found error");
delete l_err;
+ l_err = nullptr;
}
diff --git a/src/usr/runtime/hdatservice.C b/src/usr/runtime/hdatservice.C
index 154a588ce..88d417c38 100644
--- a/src/usr/runtime/hdatservice.C
+++ b/src/usr/runtime/hdatservice.C
@@ -1136,8 +1136,8 @@ errlHndl_t hdatService::findSpira( void )
}
} while(0);
- if( errhdl_s ) { delete errhdl_s; }
- if( errhdl_l ) { delete errhdl_l; }
+ if( errhdl_s ) { delete errhdl_s; errhdl_s = nullptr;}
+ if( errhdl_l ) { delete errhdl_l; errhdl_l = nullptr; }
return errhdl;
}
diff --git a/src/usr/sbeio/sbe_psudd.C b/src/usr/sbeio/sbe_psudd.C
index 7796cd55b..10fbc7a8a 100644
--- a/src/usr/sbeio/sbe_psudd.C
+++ b/src/usr/sbeio/sbe_psudd.C
@@ -278,6 +278,7 @@ errlHndl_t SbePsu::writeRequest(TARGETING::Target * i_target,
false );
}
delete l_ffdc_parser;
+ l_ffdc_parser = nullptr;
}
errl->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
@@ -529,6 +530,7 @@ errlHndl_t SbePsu::pollForPsuComplete(TARGETING::Target * i_target,
{
l_respRegs[i] = 0;
delete l_errl;
+ l_errl = nullptr;
}
l_respRegsFFDC.addData(DEVICE_XSCOM_ADDRESS(l_addr));
@@ -616,6 +618,7 @@ errlHndl_t SbePsu::pollForPsuComplete(TARGETING::Target * i_target,
false );
}
delete l_ffdc_parser;
+ l_ffdc_parser = nullptr;
}
// save the mbox status regs as FFDC
diff --git a/src/usr/scom/scom.C b/src/usr/scom/scom.C
index d225eac02..72946642f 100644
--- a/src/usr/scom/scom.C
+++ b/src/usr/scom/scom.C
@@ -814,6 +814,7 @@ errlHndl_t doScomOp(DeviceFW::OperationType i_opType,
&& (l_err->reasonCode() == IBSCOM::IBSCOM_RETRY_DUE_TO_ERROR) )
{
delete l_err;
+ l_err = nullptr;
TRACFCOMP(g_trac_scom, "Forcing retry of Scom to %.16X on %.8X", i_addr,
(TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL == i_target ?
0xFFFFFFFF : TARGETING::get_huid(i_target)));
@@ -927,6 +928,7 @@ void addScomFailFFDC( errlHndl_t i_err,
if( l_ignored )
{
delete l_ignored;
+ l_ignored = nullptr;
l_scomdata = 0;
}
else
diff --git a/src/usr/targeting/runtime/attrPlatOverride_rt.C b/src/usr/targeting/runtime/attrPlatOverride_rt.C
index fcd6aabc1..b89c93bb4 100644
--- a/src/usr/targeting/runtime/attrPlatOverride_rt.C
+++ b/src/usr/targeting/runtime/attrPlatOverride_rt.C
@@ -167,6 +167,7 @@ void applyTempOverrides()
// if the new RHB is in use, this will always fail
// so just delete the error
delete l_err;
+ l_err = nullptr;
}
else
{
diff --git a/src/usr/util/runtime/rt_cmds.C b/src/usr/util/runtime/rt_cmds.C
index 3984f9f8f..beddbb5d4 100644
--- a/src/usr/util/runtime/rt_cmds.C
+++ b/src/usr/util/runtime/rt_cmds.C
@@ -513,6 +513,7 @@ void cmd_readpnor( char*& o_output,
o_output = new char[100];
sprintf( o_output, "Error from getSectionInfo()" );
delete l_errhdl;
+ l_errhdl = nullptr;
return;
}
diff --git a/src/usr/vfs/vfsrp.C b/src/usr/vfs/vfsrp.C
index 0682460ee..f8cb8d253 100644
--- a/src/usr/vfs/vfsrp.C
+++ b/src/usr/vfs/vfsrp.C
@@ -287,6 +287,7 @@ void VfsRp::_vfsWatcher()
else // Crit error already generated
{
delete err;
+ err = nullptr;
}
iv_msg->data[1] = -EIO; /* I/O error */
diff --git a/src/usr/xscom/xscom.C b/src/usr/xscom/xscom.C
index 422063729..647111cfd 100644
--- a/src/usr/xscom/xscom.C
+++ b/src/usr/xscom/xscom.C
@@ -598,6 +598,7 @@ void resetScomEngine(TARGETING::Target* i_target,
{
// Delete thie errorlog as this is in the errorpath already.
delete l_err;
+ l_err = nullptr;
TRACFCOMP(g_trac_xscom,ERR_MRK "XSCOM RESET FAILED: XscomAddr = %.16llx, VAddr=%llx",XscomAddr[i], l_virtAddr );
}
@@ -674,6 +675,7 @@ void collectXscomFFDC(TARGETING::Target* i_target,
if (l_err)
{
delete l_err;
+ l_err = nullptr;
TRACFCOMP(g_trac_xscom,ERR_MRK "XSCOM Collect FFDC FAILED: XscomAddr = %.16llx, VAddr=%llx",XscomAddr[i], l_virtAddr);
}
OpenPOWER on IntegriCloud