aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-05-16 17:20:37 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-05-19 09:22:57 +1000
commitbb192fd55ffb20d619101c5e3e1f4fd24f844d11 (patch)
tree432c6db801d96c9269244f67fafe1b056e6ce543
parent40cf5a391a80a75f8827d2427e49a92e73871b00 (diff)
downloadskiboot-bb192fd55ffb20d619101c5e3e1f4fd24f844d11.zip
skiboot-bb192fd55ffb20d619101c5e3e1f4fd24f844d11.tar.gz
skiboot-bb192fd55ffb20d619101c5e3e1f4fd24f844d11.tar.bz2
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 <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/p8-i2c.c2
1 files changed, 0 insertions, 2 deletions
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;
}