diff options
author | Matthew Raybuck <matthew.raybuck@ibm.com> | 2019-03-29 14:12:51 -0500 |
---|---|---|
committer | Nicholas E. Bofferding <bofferdn@us.ibm.com> | 2019-03-30 17:55:50 -0500 |
commit | ac7a4f206efe2dd97c6e6d86c1db6bf39e40cd86 (patch) | |
tree | 3a349e385f9e0f6892b18e995a42bf628841e05f | |
parent | 571956c7f546d84211d955b93d540a992795544a (diff) | |
download | talos-hostboot-ac7a4f206efe2dd97c6e6d86c1db6bf39e40cd86.tar.gz talos-hostboot-ac7a4f206efe2dd97c6e6d86c1db6bf39e40cd86.zip |
Fix UCD retry loop size bug
There is a bug in the attemptDeviceOp code where an error during the
deviceOp function will overwrite the io_bufferLength value causing the
retry loop to fail permanently on subsequent retries.
Change-Id: Ib525e60e1c6cca2604a279cc595946a92cd4f94d
RTC: 205982
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/75243
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com>
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: Nicholas E. Bofferding <bofferdn@us.ibm.com>
-rw-r--r-- | src/usr/isteps/ucd/updateUcdFlash.C | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/usr/isteps/ucd/updateUcdFlash.C b/src/usr/isteps/ucd/updateUcdFlash.C index 5648a331f..267fb06fc 100644 --- a/src/usr/isteps/ucd/updateUcdFlash.C +++ b/src/usr/isteps/ucd/updateUcdFlash.C @@ -1282,14 +1282,22 @@ public: errlHndl_t pNonRetryableError = nullptr; errlHndl_t pRetryableError = nullptr; errlHndl_t pUcdError = nullptr; + size_t size = 0; for (uint8_t retry = 0; retry <= UCD_MAX_RETRIES; ++retry) { + // If an error occurs during the deviceOp then it's possible the + // size will be overwritten. So, create a local variable with the + // requested size. Regardless of success or failure the size + // returned from the final deviceOp will be written to + // io_bufferLength. + size = io_bufferLength; + // Perform deviceOp pUcdError = performDeviceOp(i_opType, i_smbusOpType, io_buffer, - io_bufferLength, + size, i_cmd); if ( (pUcdError != nullptr) @@ -1410,6 +1418,10 @@ public: } } + // Regardless of success or failure, update io_bufferLength with final + // size returned from performDeviceOp(). + io_bufferLength = size; + return pNonRetryableError; } |