From 6819730ea3169c56f454cf015679e1ea533dbecc Mon Sep 17 00:00:00 2001 From: Felix Kuehling Date: Mon, 5 Nov 2018 20:25:45 -0500 Subject: [PATCH] libhsakmt: Distinguish EPERM and EACCES EPERM means "operation not permitted" and is returned when CGroup access checks fail. EACCES means "permission denied" and is returned when the device file permission bits or access control list don't allow access. EPERM can fail silently, since we assume the administrator disabled a device on purpose in the CGroup. EACCESS should produce an error message and an info message to check the device file permissions. Change-Id: Iee4c5584c5fdc4e113c3d760dede6661097b4341 Signed-off-by: Felix Kuehling [ROCm/ROCR-Runtime commit: 5e4e19d47b9db9c263f5fbe95dd45e92ea2eb4e0] --- projects/rocr-runtime/src/fmm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/rocr-runtime/src/fmm.c b/projects/rocr-runtime/src/fmm.c index 1b70c9e5f0..fdca89067f 100644 --- a/projects/rocr-runtime/src/fmm.c +++ b/projects/rocr-runtime/src/fmm.c @@ -1733,10 +1733,10 @@ int open_drm_render_device(int minor) sprintf(path, "/dev/dri/renderD%d", minor); fd = open(path, O_RDWR | O_CLOEXEC); if (fd < 0) { - if (errno != ENOENT) { - if (errno == EPERM) - pr_info("Check a) User is in \"video\" group b) cgroup permissions\n"); + if (errno != ENOENT && errno != EPERM) { pr_err("Failed to open %s: %s\n", path, strerror(errno)); + if (errno == EACCES) + pr_info("Check user is in \"video\" group\n"); } return -errno; }