[Accel-config] [PATCH v1 5/5] accel-config: Print error message associated with error if enable fails

ramesh.thomas at intel.com
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Print associated error message of failed reason when device enable
fails.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/enable.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/accfg/enable.c b/accfg/enable.c
index 8fbdbb0..34328ca 100644
--- a/accfg/enable.c
+++ b/accfg/enable.c
@@ -172,7 +172,8 @@ static int device_action(int argc, const char **argv, const char *usage,
 	}
 
 	if (fail_reason) {
-		fprintf(stderr, "failed due to reason %d\n", fail_reason);
+		fprintf(stderr, "failed due to reason %s\n",
+				strerror(abs(fail_reason)));
 		return fail_reason;
 	}
 
@@ -334,8 +335,8 @@ static int wq_action(int argc, const char **argv, const char *usage,
 	}
 
 	if (fail_reason) {
-		fprintf(stderr, "failed due to reason %d\n",
-			fail_reason);
+		fprintf(stderr, "failed due to reason %s\n",
+			strerror(abs(fail_reason)));
 		return fail_reason;
 	}
 	return -ENXIO;
-- 
2.26.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.