[coreboot-gerrit] Change in coreboot[master]: drivers/i2c/sx9310: Check for config not being NULL before using it

Furquan Shaikh (Code Review) gerrit at coreboot.org
Fri Jun 22 19:15:53 CEST 2018


Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/27207


Change subject: drivers/i2c/sx9310: Check for config not being NULL before using it
......................................................................

drivers/i2c/sx9310: Check for config not being NULL before using it

This change fixes the issue reported by Coverity CID 1393576 to ensure
that config is checked for NULL before it is actually used.

Change-Id: I5f0cd2bf2437fc640f4cf8d8203a971daf1f8d17
Signed-off-by: Furquan Shaikh <furquan at google.com>
---
M src/drivers/i2c/sx9310/sx9310.c
1 file changed, 4 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/07/27207/1

diff --git a/src/drivers/i2c/sx9310/sx9310.c b/src/drivers/i2c/sx9310/sx9310.c
index 7da87c4..5f63734 100644
--- a/src/drivers/i2c/sx9310/sx9310.c
+++ b/src/drivers/i2c/sx9310/sx9310.c
@@ -36,7 +36,7 @@
 	struct acpi_i2c i2c = {
 		.address = dev->path.i2c.device,
 		.mode_10bit = dev->path.i2c.mode_10bit,
-		.speed = config->speed ? : I2C_SPEED_FAST,
+		.speed = I2C_SPEED_FAST,
 		.resource = scope,
 	};
 	struct acpi_dp *dsd;
@@ -44,6 +44,9 @@
 	if (!dev->enabled || !scope || !config)
 		return;
 
+	if (config->speed)
+		i2c.speed = config->speed;
+
 	/* Device */
 	acpigen_write_scope(scope);
 	acpigen_write_device(acpi_device_name(dev));

-- 
To view, visit https://review.coreboot.org/27207
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: I5f0cd2bf2437fc640f4cf8d8203a971daf1f8d17
Gerrit-Change-Number: 27207
Gerrit-PatchSet: 1
Gerrit-Owner: Furquan Shaikh <furquan at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180622/dfeb5b6d/attachment.html>


More information about the coreboot-gerrit mailing list