aboutsummaryrefslogtreecommitdiff
path: root/hw/imc.c
diff options
context:
space:
mode:
authorMadhavan Srinivasan <maddy@linux.vnet.ibm.com>2017-09-11 13:43:57 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-09-12 22:52:08 -0500
commit8782c0da7243fb6c608e6a00fd90957423832481 (patch)
tree424efbfd5f2e04093eeb159610b62f27909b0a46 /hw/imc.c
parent6bfa7b56b738de273ddb17434f5d57d555592da9 (diff)
downloadskiboot-8782c0da7243fb6c608e6a00fd90957423832481.zip
skiboot-8782c0da7243fb6c608e6a00fd90957423832481.tar.gz
skiboot-8782c0da7243fb6c608e6a00fd90957423832481.tar.bz2
skiboot/hw/imc: Add NULL pointer check
Minor cleanup to avoid null pointer access. Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/imc.c')
-rw-r--r--hw/imc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/imc.c b/hw/imc.c
index 3db67a2..ccf3973 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -599,6 +599,8 @@ static int64_t opal_imc_counters_start(uint32_t type, uint64_t cpu_pir)
case OPAL_IMC_COUNTERS_NEST:
/* Fetch the IMC control block structure */
cb = get_imc_cb(c->chip_id);
+ if (!cb)
+ return OPAL_HARDWARE;
/* Set the run command */
op = NEST_IMC_ENABLE;
@@ -651,6 +653,8 @@ static int64_t opal_imc_counters_stop(uint32_t type, uint64_t cpu_pir)
case OPAL_IMC_COUNTERS_NEST:
/* Fetch the IMC control block structure */
cb = get_imc_cb(c->chip_id);
+ if (!cb)
+ return OPAL_HARDWARE;
/* Set the run command */
op = NEST_IMC_DISABLE;