soc/intel/common/sgx: Fix null pointer dereference warning from klocwork
Fix the warnings of klocwork scan. e.g. "Pointer 'dev' checked for NULL at line 158 will be dereferenced at line 159" Change-Id: I6cc9c68652b074c666c86456183460ca38a886ed Signed-off-by: Pratik Prajapati <pratikkumar.v.prajapati@intel.com> Reviewed-on: https://review.coreboot.org/21408 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
2be64048c1
commit
6dc148a42b
|
@ -41,8 +41,14 @@ void prmrr_core_configure(void)
|
||||||
msr_t prmrr_mask;
|
msr_t prmrr_mask;
|
||||||
msr_t msr;
|
msr_t msr;
|
||||||
device_t dev = SA_DEV_ROOT;
|
device_t dev = SA_DEV_ROOT;
|
||||||
|
assert(dev != NULL);
|
||||||
config_t *conf = dev->chip_info;
|
config_t *conf = dev->chip_info;
|
||||||
|
|
||||||
|
if (!conf) {
|
||||||
|
printk(BIOS_ERR, "SGX: failed to get chip_info\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!conf->sgx_enable || !is_sgx_supported())
|
if (!conf->sgx_enable || !is_sgx_supported())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -159,6 +165,11 @@ void sgx_configure(void)
|
||||||
config_t *conf = dev->chip_info;
|
config_t *conf = dev->chip_info;
|
||||||
const void *microcode_patch = intel_mp_current_microcode();
|
const void *microcode_patch = intel_mp_current_microcode();
|
||||||
|
|
||||||
|
if (!conf) {
|
||||||
|
printk(BIOS_ERR, "SGX: failed to get chip_info\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!conf->sgx_enable || !is_sgx_supported() || !is_prmrr_set()) {
|
if (!conf->sgx_enable || !is_sgx_supported() || !is_prmrr_set()) {
|
||||||
printk(BIOS_ERR, "SGX: pre-conditions not met\n");
|
printk(BIOS_ERR, "SGX: pre-conditions not met\n");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue