[Skiboot] [PATCH] hw/i2c: Fix early lock drop

Oliver O'Halloran oohall at gmail.com
Tue May 16 17:20:37 AEST 2017


When interacting with an I2C master the p8-i2c driver (common to p9)
aquires a per-master lock which it holds for the duration of it's
interaction with the master.  Unfortunately, when
p8_i2c_check_initial_status() detects that the master is busy with
another transaction it drops the lock and returns OPAL_BUSY. This is
contrary to the driver's locking strategy which requires that the
caller aquire and drop the lock. This leads to a crash due to the
double unlock(), which skiboot treats as fatal.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 hw/p8-i2c.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index 3bce0b162832..fefc1d4b250b 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -990,7 +990,6 @@ static int p8_i2c_check_initial_status(struct p8_i2c_master_port *port)
 
 		/* Delay 5ms for bus to settle */
 		schedule_timer(&master->recovery, msecs_to_tb(5));
-		unlock(&master->lock);
 		return OPAL_BUSY;
 	}
 
@@ -1010,7 +1009,6 @@ static int p8_i2c_check_initial_status(struct p8_i2c_master_port *port)
 
 		/* Delay 5ms for bus to settle */
 		schedule_timer(&master->recovery, msecs_to_tb(5));
-		unlock(&master->lock);
 		return OPAL_BUSY;
 	}
 
-- 
2.9.3



More information about the Skiboot mailing list