[coreboot-gerrit] Patch set updated for coreboot: device/smbus: Avoid infinite loop if i2c device has wrong parent

Timothy Pearson (tpearson@raptorengineeringinc.com) gerrit at coreboot.org
Fri Oct 23 04:36:33 CEST 2015


Timothy Pearson (tpearson at raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12131

-gerrit

commit 1a96f4c2ae0d0f775b8b2b099a3cd4d698ef472d
Author: Timothy Pearson <tpearson at raptorengineeringinc.com>
Date:   Thu Oct 22 17:19:19 2015 -0500

    device/smbus: Avoid infinite loop if i2c device has wrong parent
    
    Change-Id: I4c615f3c5b3908178b8223cb6620c393bbfb4e7f
    Signed-off-by: Timothy Pearson <tpearson at raptorengineeringinc.com>
---
 src/device/smbus_ops.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/device/smbus_ops.c b/src/device/smbus_ops.c
index 184a06a..f4b1355 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) {



More information about the coreboot-gerrit mailing list