[Skiboot] [PATCH 5/7] llvm-scan-build: fix value stored to rc never read in hw/occ.c

Stewart Smith stewart at linux.vnet.ibm.com
Tue Nov 10 18:44:11 AEDT 2015


hw/occ.c:278:2: warning: Value stored to 'rc' is never read
        rc = xscom_read(chip->id, XSCOM_ADDR_P8_EX_SLAVE(core, EX_PM_PPMCR), &tmp);
        ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/occ.c:309:2: warning: Value stored to 'rc' is never read
        rc = xscom_read(chip->id, XSCOM_ADDR_P8_EX_SLAVE(core, EX_PM_PPMSR), &tmp);
        ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 hw/occ.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/occ.c b/hw/occ.c
index 9c696db68a96..0f2b03718848 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -276,6 +276,11 @@ static bool cpu_pstates_prepare_core(struct proc_chip *chip, struct cpu_thread *
 
 	/* Set new pstate to core */
 	rc = xscom_read(chip->id, XSCOM_ADDR_P8_EX_SLAVE(core, EX_PM_PPMCR), &tmp);
+	if (rc) {
+		log_simple_error(&e_info(OPAL_RC_OCC_PSTATE_INIT),
+			"OCC: Failed to read from OCC in pstates init\n");
+		return false;
+	}
 	tmp = tmp & ~0xFFFF000000000000ULL;
 	pstate = ((uint64_t) pstate_nom) & 0xFF;
 	tmp = tmp | (pstate << 56) | (pstate << 48);
@@ -307,6 +312,12 @@ static bool cpu_pstates_prepare_core(struct proc_chip *chip, struct cpu_thread *
 
 	/* Just debug */
 	rc = xscom_read(chip->id, XSCOM_ADDR_P8_EX_SLAVE(core, EX_PM_PPMSR), &tmp);
+	if (rc) {
+		log_simple_error(&e_info(OPAL_RC_OCC_PSTATE_INIT),
+			"OCC: Failed to read back setting from OCC"
+				 "in pstates init\n");
+		return false;
+	}
 	prlog(PR_DEBUG, "OCC: Chip %x Core %x PPMSR %016llx\n",
 	      chip->id, core, tmp);
 
-- 
2.1.4



More information about the Skiboot mailing list