drivers: peci: xec: Re-add error recovery handling

Using temp variable to avoid coverity issue without breakin
error recovery.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
This commit is contained in:
Jose Alberto Meza 2020-03-23 15:23:48 -07:00 committed by Andrew Boie
commit 04e190ab87

View file

@ -242,6 +242,7 @@ static int peci_xec_transfer(struct device *dev, struct peci_msg *msg)
ARG_UNUSED(dev);
int ret;
PECI_Type *base = peci_xec_config.base;
u8_t err_val = base->ERROR;
ret = peci_xec_write(dev, msg);
if (ret) {
@ -264,7 +265,7 @@ static int peci_xec_transfer(struct device *dev, struct peci_msg *msg)
}
/* Check for error conditions and perform bus recovery if necessary */
if (base->ERROR) {
if (err_val) {
if (base->ERROR & MCHP_PECI_ERR_RDOV) {
LOG_WRN("Read buffer is not empty\n");
}
@ -281,6 +282,11 @@ static int peci_xec_transfer(struct device *dev, struct peci_msg *msg)
return -EIO;
}
/* ERROR is a clear-on-write register, need to clear errors occurred
* at the end of a transaction.
*/
base->ERROR = err_val;
return 0;
}