From bb192fd55ffb20d619101c5e3e1f4fd24f844d11 Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Tue, 16 May 2017 17:20:37 +1000 Subject: hw/i2c: Fix early lock drop 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 Signed-off-by: Stewart Smith --- hw/p8-i2c.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'hw/p8-i2c.c') diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c index 3bce0b1..fefc1d4 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; } -- cgit v1.1