[Skiboot] [PATCH 6/9] hw/imc: Don't dereference possible NULL

Cyril Bur cyril.bur at au1.ibm.com
Mon Mar 19 15:54:17 AEDT 2018


Fixes: CID 263056 and 263052
Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 hw/imc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/imc.c b/hw/imc.c
index 5bc59b59..53e84c26 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -634,7 +634,6 @@ static int64_t opal_imc_counters_init(uint32_t type, uint64_t addr, uint64_t cpu
 {
 	struct cpu_thread *c = find_cpu_by_pir(cpu_pir);
 	int port_id, phys_core_id;
-	struct proc_chip *chip = get_chip(c->chip_id);
 	int ret;
 	uint32_t scoms;
 
@@ -681,6 +680,8 @@ static int64_t opal_imc_counters_init(uint32_t type, uint64_t addr, uint64_t cpu
 
 		if (has_deep_states) {
 			if ((wakeup_engine_state == WAKEUP_ENGINE_PRESENT)) {
+				struct proc_chip *chip = get_chip(c->chip_id);
+
 				prlog(PR_INFO, "Configuring stopapi for IMC\n");
 				scoms = XSCOM_ADDR_P9_EP(phys_core_id,pdbar_scom_index[port_id]);
 				ret = p9_stop_save_scom(( void *)chip->homer_base,scoms,
-- 
2.16.2



More information about the Skiboot mailing list