summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Zhao <john.zhao@intel.com>2018-10-16 10:48:00 -0700
committerPatrick Georgi <pgeorgi@google.com>2018-10-18 12:45:06 +0000
commit0ccfc0cc5327b2da6ac062eeda8fdf2afdf6a532 (patch)
treee9ef5f12cc686282ef165a644be94b69a8c5ed44 /src
parent9b7ae2f3fccd9fd568dbc33b91bec8a0162754ee (diff)
downloadcoreboot-0ccfc0cc5327b2da6ac062eeda8fdf2afdf6a532.tar.xz
intel/common/block: Fix issue found by klockwork
src/soc/intel/common/block/pmc/pmclib.c Function acpi_get_sleep_type: Pointer ps checked for NULL may be dereferenced. BRANCH=None TEST=Built & booted Yorp board. Change-Id: I15fe39fd9f930be56d03c2ffe62fb6f17249d4b5 Signed-off-by: John Zhao <john.zhao@intel.com> Reviewed-on: https://review.coreboot.org/29149 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/common/block/pmc/pmclib.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c
index cfe8011458..ef4384d395 100644
--- a/src/soc/intel/common/block/pmc/pmclib.c
+++ b/src/soc/intel/common/block/pmc/pmclib.c
@@ -95,9 +95,13 @@ __weak void pmc_soc_restore_power_failure(void)
int acpi_get_sleep_type(void)
{
struct chipset_power_state *ps;
+ int prev_sleep_state = ACPI_S0;
ps = pmc_get_power_state();
- return ps->prev_sleep_state;
+ if (ps)
+ prev_sleep_state = ps->prev_sleep_state;
+
+ return prev_sleep_state;
}
static uint32_t pmc_reset_smi_status(void)