[coreboot-gerrit] Change in coreboot[master]: soc/intel/skylake: check for NULL with if condition

Pratikkumar V Prajapati (Code Review) gerrit at coreboot.org
Wed Oct 3 02:14:27 CEST 2018


Pratikkumar V Prajapati has uploaded this change for review. ( https://review.coreboot.org/28888


Change subject: soc/intel/skylake: check for NULL with if condition
......................................................................

soc/intel/skylake: check for NULL with if condition

To make klockwork happy, this patch removes assert() and checks
if the dev is NULL with if condition only.

Change-Id: Icd2c8490c8bda14ecd752437d463a7110fe40aea
Signed-off-by: Pratik Prajapati <pratikkumar.v.prajapati at intel.com>
---
M src/soc/intel/skylake/cpu.c
1 file changed, 14 insertions(+), 4 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/88/28888/1

diff --git a/src/soc/intel/skylake/cpu.c b/src/soc/intel/skylake/cpu.c
index 417c4bc..3733fe0 100644
--- a/src/soc/intel/skylake/cpu.c
+++ b/src/soc/intel/skylake/cpu.c
@@ -547,9 +547,14 @@
 int soc_fill_sgx_param(struct sgx_param *sgx_param)
 {
 	struct device *dev = SA_DEV_ROOT;
-	assert(dev != NULL);
-	config_t *conf = dev->chip_info;
+	config_t *conf;
 
+	if (!dev) {
+		printk(BIOS_ERR, "Failed to get root dev for checking SGX param\n");
+		return -1;
+	}
+
+	conf = dev->chip_info;
 	if (!conf) {
 		printk(BIOS_ERR, "Failed to get chip_info for SGX param\n");
 		return -1;
@@ -561,9 +566,14 @@
 int soc_fill_vmx_param(struct vmx_param *vmx_param)
 {
 	struct device *dev = SA_DEV_ROOT;
-	assert(dev != NULL);
-	config_t *conf = dev->chip_info;
+	config_t *conf;
 
+	if (!dev) {
+		printk(BIOS_ERR, "Failed to get root dev for checking VMX param\n");
+		return -1;
+	}
+
+	conf = dev->chip_info;
 	if (!conf) {
 		printk(BIOS_ERR, "Failed to get chip_info for VMX param\n");
 		return -1;

-- 
To view, visit https://review.coreboot.org/28888
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd2c8490c8bda14ecd752437d463a7110fe40aea
Gerrit-Change-Number: 28888
Gerrit-PatchSet: 1
Gerrit-Owner: Pratikkumar V Prajapati <pratikkumar.v.prajapati at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181003/37b35843/attachment.html>


More information about the coreboot-gerrit mailing list