[Skiboot] [PATCH V2] [lpc] Fix locking

Ananth N Mavinakayanahalli ananth at in.ibm.com
Tue Jun 16 20:56:12 AEST 2015


Release lock before bailing out.

Signed-off-by: Ananth N Mavinakayanahalli <ananth at in.ibm.com>

V2: Handle the 2nd instance of the same issue in the file.
---
 hw/lpc.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/lpc.c b/hw/lpc.c
index b287020..1eb2b58 100644
--- a/hw/lpc.c
+++ b/hw/lpc.c
@@ -343,10 +343,9 @@ static int64_t __lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type,
 	/* Perform OPB access */
 	rc = opb_write(chip, opb_base + addr, data, sz);
 
-	unlock(&chip->lpc_lock);
-
 	/* XXX Add LPC error handling/recovery */
  bail:
+	unlock(&chip->lpc_lock);
 	return rc;
 }
 
@@ -403,10 +402,9 @@ static int64_t __lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type,
 	/* Perform OPB access */
 	rc = opb_read(chip, opb_base + addr, data, sz);
 
-	unlock(&chip->lpc_lock);
-
 	/* XXX Add LPC error handling/recovery */
  bail:
+	unlock(&chip->lpc_lock);
 	return rc;
 }
 



More information about the Skiboot mailing list