[Accel-config] [PATCH v1] accel-config: Return error if DSA environment not found

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

Check for presence of DSA sysfs folder /sys/bus/dsa before running
commands. If not found print an error message and return -ENOENT

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/accel-config.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/accfg/accel-config.c b/accfg/accel-config.c
index f963fc7..01a1cd9 100644
--- a/accfg/accel-config.c
+++ b/accfg/accel-config.c
@@ -95,6 +95,12 @@ int main(int argc, const char **argv)
 		return 0;
 	}
 
+	if (access("/sys/bus/dsa", R_OK)) {
+		fprintf(stderr,
+			"DSA environment not found. Is the driver loaded?\n");
+		return -ENOENT;
+	}
+
 	rc = accfg_new(&ctx);
 	if (rc)
 		return 0;
-- 
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.