aboutsummaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorMatt DeVillier <matt.devillier@gmail.com>2022-06-18 15:22:47 -0500
committerFelix Held <felix-coreboot@felixheld.de>2022-06-21 12:28:07 +0000
commit06abb91b22b5911315e65ad6b287ba51a7f28eac (patch)
treef564dfba7553841e9f91961b0fc62a7e77df69e4 /src/device
parentf887879815abc28c8decec2355ec22df6f230588 (diff)
device/i2c_bus: Check for self loop in bus link
When trying to find the parent i2c bus of a given device, ensure that the bus link doesn't point to itself, else we'll get stuck in an infinite loop. Change-Id: I56cb6b2a3e4f98d2ce3ef2d8298e74d52661331c Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/65229 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/device')
-rw-r--r--src/device/i2c_bus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/device/i2c_bus.c b/src/device/i2c_bus.c
index c355506f72..df36404660 100644
--- a/src/device/i2c_bus.c
+++ b/src/device/i2c_bus.c
@@ -25,7 +25,7 @@ struct bus *i2c_link(const struct device *const dev)
(parent->ops->ops_i2c_bus || parent->ops->ops_smbus_bus))
break;
- if (parent && parent->bus)
+ if (parent && parent->bus && link != parent->bus)
link = parent->bus;
else
link = NULL;