[Skiboot] [PATCH 02/34] p8-i2c: Don't crash if a centaur errored out

Benjamin Herrenschmidt benh at kernel.crashing.org
Sun Jul 24 09:26:56 AEST 2016


If we had XSCOM/FSI errors accessing a centaur, we assert later
on when trying to create it's i2c bus. Don't, just file an error log

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 hw/p8-i2c.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index fde9a80..4e29432 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -1288,7 +1288,13 @@ static void p8_i2c_init_one(struct dt_node *i2cm, enum p8_i2c_master_type type)
 	master->xscom_base = dt_get_address(i2cm, 0, NULL);
 	if (master->type == I2C_CENTAUR) {
 		struct centaur_chip *centaur = get_centaur(master->chip_id);
-		assert(centaur);
+		if (centaur == NULL) {
+			log_simple_error(&e_info(OPAL_RC_I2C_INIT),
+					 "I2C: Failed to get centaur 0x%x ",
+					 master->chip_id);
+			free(master);
+			return;
+		}
 		chip_list = &centaur->i2cms;
 
 		/* Detect bad device-tree from HostBoot giving us bogus
-- 
2.7.4



More information about the Skiboot mailing list