summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShaik Shahina <shahina.shaik@intel.com>2022-10-27 18:18:20 +0530
committerMartin L Roth <gaumless@gmail.com>2022-10-29 02:43:41 +0000
commit14dad2670e4101be990a0e3ac5fe15ca30ca06b3 (patch)
treeef6a1ba92fe2017402a17558cb1325d4b15f9bc3 /src
parentbf2f6e27297571da6d15ad93dd71bf0c0b38281b (diff)
soc/intel/common: Fix potential NULL pointer dereference
BUG=NONE TEST=Boot to OS on Nivviks Change-Id: I154011963e945b54dfca07f884e473d44dc4e813 Signed-off-by: Shaik Shahina <shahina.shaik@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68903 Reviewed-by: Rizwan Qureshi <rizwan.qureshi@intel.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Sridhar Siricilla <sridhar.siricilla@intel.com> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/common/basecode/debug/debug_feature.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/soc/intel/common/basecode/debug/debug_feature.c b/src/soc/intel/common/basecode/debug/debug_feature.c
index 4b9a7cbf2e..64919346f8 100644
--- a/src/soc/intel/common/basecode/debug/debug_feature.c
+++ b/src/soc/intel/common/basecode/debug/debug_feature.c
@@ -30,7 +30,14 @@ bool is_debug_cse_fw_update_disable(void)
enum cb_err dbg_feature_cntrl_init(void)
{
- if (spi_flash_read(boot_device_spi_flash(), DEBUG_FEATURE_CTRL_OFFSET,
+ const struct spi_flash *spi_flash_dev = boot_device_spi_flash();
+
+ if (spi_flash_dev == NULL) {
+ printk(BIOS_ERR, "Failed to Initialize boot device SPI flash\n");
+ return CB_ERR;
+ }
+
+ if (spi_flash_read(spi_flash_dev, DEBUG_FEATURE_CTRL_OFFSET,
DEBUG_FEATURE_CTRL_SZ, &dbg_feature_cntrl)) {
printk(BIOS_ERR, "Failed to read Descriptor Region from SPI Flash\n");
return CB_ERR;