summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drivers/i2c/generic/generic.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c
index 7f1ce16fea..1b12df57d3 100644
--- a/src/drivers/i2c/generic/generic.c
+++ b/src/drivers/i2c/generic/generic.c
@@ -202,6 +202,9 @@ static void i2c_generic_enable(struct device *dev)
{
struct drivers_i2c_generic_config *config = dev->chip_info;
+ if (!config)
+ return;
+
/* Check if device is present by reading GPIO */
if (config->device_present_gpio) {
int present = gpio_get(config->device_present_gpio);
@@ -219,9 +222,8 @@ static void i2c_generic_enable(struct device *dev)
dev->ops = &i2c_generic_ops;
/* Name the device as per description provided in devicetree */
- if (config && config->desc) {
+ if (config->desc)
dev->name = config->desc;
- }
}
struct chip_operations drivers_i2c_generic_ops = {