summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/device/i2c_bus.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/device/i2c_bus.c b/src/device/i2c_bus.c
index 361bb67df8..1d4aa2d2b3 100644
--- a/src/device/i2c_bus.c
+++ b/src/device/i2c_bus.c
@@ -11,6 +11,8 @@
bool i2c_dev_detect(struct device *dev, unsigned int addr)
{
struct i2c_msg seg = { .flags = 0, .slave = addr, .buf = NULL, .len = 0 };
+ if (!dev)
+ return false;
return dev->ops->ops_i2c_bus->transfer(dev, &seg, 1) == 0;
}