aboutsummaryrefslogtreecommitdiff
path: root/hw/xscom.c
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-06-11 17:10:51 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-06-11 17:10:51 +1000
commit874b4399c23f09985324826f867ac5d22062b2f5 (patch)
treeb2f118786dab0a7c943bf57b88da67241a4e9917 /hw/xscom.c
parente0ab4a2dae4028eaeb9a188c901704f40dc6e872 (diff)
downloadskiboot-874b4399c23f09985324826f867ac5d22062b2f5.zip
skiboot-874b4399c23f09985324826f867ac5d22062b2f5.tar.gz
skiboot-874b4399c23f09985324826f867ac5d22062b2f5.tar.bz2
Fix possible return garbage from xscom_read_cfam_chipid()
If we get an error from the xscom_read() call we could extract a garbage chip_id rather than just returning an error. Caught by LLVM scan-build Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/xscom.c')
-rw-r--r--hw/xscom.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/xscom.c b/hw/xscom.c
index c023a9d..9d3523c 100644
--- a/hw/xscom.c
+++ b/hw/xscom.c
@@ -433,7 +433,8 @@ int64_t xscom_read_cfam_chipid(uint32_t partid, uint32_t *chip_id)
rc = xscom_read(partid, 0xf000f, &val);
/* Extract CFAM id */
- *chip_id = (uint32_t)(val >> 44);
+ if (rc == OPAL_SUCCESS)
+ *chip_id = (uint32_t)(val >> 44);
return rc;
}