37e5ab
From 7f841902eb50ca77c3aa884e3fd924c2bbd817ca Mon Sep 17 00:00:00 2001
37e5ab
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
37e5ab
Date: Mon, 13 Jun 2016 09:33:57 -0400
37e5ab
Subject: [PATCH] librtas: Fix endianess issue in errinjct rtas call
37e5ab
37e5ab
Unlike other RTAS calls, first output parameter of "ibm,open-errinjct"
37e5ab
is "open token", not status value.
37e5ab
37e5ab
With commit ee457b1c, we endedup calling be32toh twice for otoken and
37e5ab
didn't convert status from BE to host format.
37e5ab
37e5ab
This patch fixes above issue.
37e5ab
37e5ab
Fixes: ee457b1c (librtas: consolidate common actions in making a rtas call)
37e5ab
37e5ab
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
37e5ab
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
37e5ab
Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
37e5ab
---
37e5ab
 librtas_src/syscall_calls.c | 11 ++++++++---
37e5ab
 1 file changed, 8 insertions(+), 3 deletions(-)
37e5ab
37e5ab
diff --git a/librtas_src/syscall_calls.c b/librtas_src/syscall_calls.c
37e5ab
index cb668dc..a194e4b 100644
37e5ab
--- a/librtas_src/syscall_calls.c
37e5ab
+++ b/librtas_src/syscall_calls.c
37e5ab
@@ -466,15 +466,20 @@ int rtas_errinjct_close(int otoken)
37e5ab
  */
37e5ab
 int rtas_errinjct_open(int *otoken)
37e5ab
 {
37e5ab
-	__be32 be_otoken;
37e5ab
+	__be32 be_status;
37e5ab
 	int rc, status;
37e5ab
 
37e5ab
 	rc = sanity_check();
37e5ab
 	if (rc)
37e5ab
 		return rc;
37e5ab
 
37e5ab
-	rc = rtas_call("ibm,open-errinjct", 0, 2, &be_otoken, &status);
37e5ab
-	*otoken = be32toh(be_otoken);
37e5ab
+	/*
37e5ab
+	 * Unlike other RTAS calls, here first output parameter is otoken,
37e5ab
+	 * not status. rtas_call converts otoken to host endianess. We
37e5ab
+	 * have to convert status parameter.
37e5ab
+	 */
37e5ab
+	rc = rtas_call("ibm,open-errinjct", 0, 2, otoken, &be_status);
37e5ab
+	status = be32toh(be_status);
37e5ab
 
37e5ab
 	dbg("(%p) = %d, %d\n", otoken, rc ? rc : status, *otoken);
37e5ab
 	return rc ? rc : status;
37e5ab
-- 
37e5ab
2.4.11
37e5ab