[Accel-config] [PATCH v1 5/7] accel-config: Print device command status only on errors

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

Skip printing "Success" message when there is no device command error
status recorded as this is called in the context of error conditions
returned by library.

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

diff --git a/accfg/enable.c b/accfg/enable.c
index d3968e4..8abbaca 100644
--- a/accfg/enable.c
+++ b/accfg/enable.c
@@ -85,9 +85,11 @@ static void print_device_cmd_status(struct accfg_device *device)
 {
 	const char *status;
 
-	status = accfg_device_get_cmd_status_str(device);
-	if (status)
-		fprintf(stderr, "device command status: %s\n", status);
+	if (accfg_device_get_cmd_status(device) > 0) {
+		status = accfg_device_get_cmd_status_str(device);
+		if (status)
+			fprintf(stderr, "device command status: %s\n", status);
+	}
 }
 
 static int device_action(int argc, const char **argv, const char *usage,
-- 
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.