diff mbox

p8-i2c OCC lock: fix locking in p9_i2c_bus_owner_change

Message ID 20170607041127.16112-1-stewart@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Stewart Smith June 7, 2017, 4:11 a.m. UTC
Fixes: c5fa0d718e9cda8999dcb83088118a7ea61814c5
Reported-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
---
 hw/p8-i2c.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index d55d08ee8c34..f4666e24953e 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -1,4 +1,4 @@ 
-/* Copyright 2013-2014 IBM Corp.
+/* Copyright 2013-2017 IBM Corp.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -1293,8 +1293,10 @@  void p9_i2c_bus_owner_change(u32 chip_id)
 
 		/* Can we now lock this master? */
 		rc = occ_i2c_lock(master);
-		if (rc)
+		if (rc) {
+			unlock(&master->lock);
 			continue;
+		}
 
 		/* Run the state machine */
 		p8_i2c_check_status(master);