soc/intel/tigerlake: Avoid NULL pointer dereference
Coverity detects pointer dev as FORWARD_NULL. Add sanity check for dev to prevent NULL pointer dereference if dev did not point to the audio device. BUG=CID 1420208 TEST=Built image successfully. Change-Id: I2a62da44c7044f9dc281eae0949f7f7b612ab238 Signed-off-by: John Zhao <john.zhao@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39261 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
58cf6030f5
commit
97fe371b9f
|
@ -95,7 +95,11 @@ static void soc_memory_init_params(FSP_M_CONFIG *m_cfg,
|
||||||
m_cfg->DdiPortCDdc = config->DdiPortCDdc;
|
m_cfg->DdiPortCDdc = config->DdiPortCDdc;
|
||||||
|
|
||||||
/* Audio */
|
/* Audio */
|
||||||
m_cfg->PchHdaEnable = pcidev_path_on_root(PCH_DEVFN_HDA) ? dev->enabled : 0;
|
dev = pcidev_path_on_root(PCH_DEVFN_HDA);
|
||||||
|
if (!dev)
|
||||||
|
m_cfg->PchHdaEnable = 0;
|
||||||
|
else
|
||||||
|
m_cfg->PchHdaEnable = dev->enabled;
|
||||||
|
|
||||||
m_cfg->PchHdaDspEnable = config->PchHdaDspEnable;
|
m_cfg->PchHdaDspEnable = config->PchHdaDspEnable;
|
||||||
m_cfg->PchHdaAudioLinkHdaEnable = config->PchHdaAudioLinkHdaEnable;
|
m_cfg->PchHdaAudioLinkHdaEnable = config->PchHdaAudioLinkHdaEnable;
|
||||||
|
|
Loading…
Reference in New Issue