[Skiboot] [PATCH] p8-i2c OCC lock: fix locking in p9_i2c_bus_owner_change

Stewart Smith stewart at linux.vnet.ibm.com
Wed Jun 7 14:11:27 AEST 2017


Fixes: c5fa0d718e9cda8999dcb83088118a7ea61814c5
Reported-by: Oliver O'Halloran <oohall at gmail.com>
Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 hw/p8-i2c.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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);
-- 
2.9.4



More information about the Skiboot mailing list