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>
This commit is contained in:
parent
bf2f6e2729
commit
14dad2670e
|
@ -30,7 +30,14 @@ bool is_debug_cse_fw_update_disable(void)
|
||||||
|
|
||||||
enum cb_err dbg_feature_cntrl_init(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)) {
|
DEBUG_FEATURE_CTRL_SZ, &dbg_feature_cntrl)) {
|
||||||
printk(BIOS_ERR, "Failed to read Descriptor Region from SPI Flash\n");
|
printk(BIOS_ERR, "Failed to read Descriptor Region from SPI Flash\n");
|
||||||
return CB_ERR;
|
return CB_ERR;
|
||||||
|
|
Loading…
Reference in New Issue