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@google.com> Reviewed-on: https://review.coreboot.org/27207 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Enrico Granata <egranata@google.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
65ddbb720b
commit
a7e925027f
|
@ -36,7 +36,7 @@ static void i2c_sx9310_fill_ssdt(struct device *dev)
|
|||
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 @@ static void i2c_sx9310_fill_ssdt(struct device *dev)
|
|||
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));
|
||||
|
|
Loading…
Reference in New Issue