summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorTimothy Pearson <tpearson@raptorengineeringinc.com>2015-10-22 17:19:19 -0500
committerNico Huber <nico.h@gmx.de>2015-10-24 01:28:08 +0200
commita693f524ca7d2c3a199f32087717ec8c3f79214a (patch)
treea297a6642cb6de33b7b89703b524f2893d78cb18 /src/device
parentccc2af14c1e0f30ae86d916f33332557bc02b83a (diff)
device/smbus: Avoid infinite loop if SMBUS device has wrong parent
If an SMBUS device in devicetree.cb is placed under a parent device that does not have an SMBUS controller, coreboot will enter an infinite loop and hang without printing any failure messages. Modify the loop to exit under these conditions, allowing the failure message to be printed. Change-Id: I4c615f3c5b3908178b8223cb6620c393bbfb4e7f Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com> Reviewed-on: http://review.coreboot.org/12131 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/device')
-rw-r--r--src/device/smbus_ops.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/device/smbus_ops.c b/src/device/smbus_ops.c
index 184a06ad6c..f4b1355d28 100644
--- a/src/device/smbus_ops.c
+++ b/src/device/smbus_ops.c
@@ -29,8 +29,17 @@ struct bus *get_pbus_smbus(device_t dev)
{
struct bus *pbus = dev->bus;
- while (pbus && pbus->dev && !ops_smbus_bus(pbus))
- pbus = pbus->dev->bus;
+ while (pbus && pbus->dev && !ops_smbus_bus(pbus)) {
+ if (pbus->dev->bus != pbus) {
+ pbus = pbus->dev->bus;
+ }
+ else {
+ printk(BIOS_WARNING,
+ "%s Find SMBus bus operations: unable to proceed\n",
+ dev_path(dev));
+ break;
+ }
+ }
if (!pbus || !pbus->dev || !pbus->dev->ops
|| !pbus->dev->ops->ops_smbus_bus) {