From 405f72952ceb0d28726cd576228fda43909951b1 Mon Sep 17 00:00:00 2001 From: Richard Spiegel Date: Wed, 14 Feb 2018 10:18:17 -0700 Subject: [PATCH] soc/amd/common/block/s3/s3_resume.c: Check mrc_cache_get_current() return Procedure mrc_cache_get_current() returns -1 for error, 0 for pass. Do check the return in procedure get_s3nv_info. This fixes CID 1385943 BUG=b:73333332 TEST=Build kahlee Change-Id: I0f6a58380a38d13120e997dcd966423d3c2af091 Signed-off-by: Richard Spiegel Reviewed-on: https://review.coreboot.org/23761 Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) --- src/soc/amd/common/block/s3/s3_resume.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/soc/amd/common/block/s3/s3_resume.c b/src/soc/amd/common/block/s3/s3_resume.c index 4883fa5597..1ba9468e35 100644 --- a/src/soc/amd/common/block/s3/s3_resume.c +++ b/src/soc/amd/common/block/s3/s3_resume.c @@ -27,7 +27,11 @@ void get_s3nv_info(void **base, size_t *size) { struct region_device rdev; - mrc_cache_get_current(MRC_TRAINING_DATA, DEFAULT_MRC_VERSION, &rdev); + if (mrc_cache_get_current(MRC_TRAINING_DATA, DEFAULT_MRC_VERSION, + &rdev)) { + printk(BIOS_ERR, "mrc_cache_get_current returned error\n"); + return; + } *base = rdev_mmap_full(&rdev); *size = region_device_sz(&rdev); if (!*base || !*size)