aboutsummaryrefslogtreecommitdiff
path: root/hw/i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/i2c.c')
-rw-r--r--hw/i2c.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/i2c.c b/hw/i2c.c
index 42a5d7a6b..16e511215 100644
--- a/hw/i2c.c
+++ b/hw/i2c.c
@@ -81,9 +81,11 @@ int i2c_start_transfer(i2c_bus *bus, int address, int recv)
i2c_slave *slave = NULL;
LIST_FOREACH(qdev, &bus->qbus.children, sibling) {
- slave = I2C_SLAVE_FROM_QDEV(qdev);
- if (slave->address == address)
+ i2c_slave *candidate = I2C_SLAVE_FROM_QDEV(qdev);
+ if (candidate->address == address) {
+ slave = candidate;
break;
+ }
}
if (!slave)