Commit 57af162b authored by Geoffrey McRae's avatar Geoffrey McRae Committed by Alex Deucher
Browse files

drm/amdkfd: return -ENOTTY for unsupported IOCTLs



Some kfd ioctls may not be available depending on the kernel version the
user is running, as such we need to report -ENOTTY so userland can
determine the cause of the ioctl failure.

Signed-off-by: default avatarGeoffrey McRae <geoffrey.mcrae@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 065e2317
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3252,8 +3252,10 @@ static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
	int retcode = -EINVAL;
	bool ptrace_attached = false;

	if (nr >= AMDKFD_CORE_IOCTL_COUNT)
	if (nr >= AMDKFD_CORE_IOCTL_COUNT) {
		retcode = -ENOTTY;
		goto err_i1;
	}

	if ((nr >= AMDKFD_COMMAND_START) && (nr < AMDKFD_COMMAND_END)) {
		u32 amdkfd_size;
@@ -3266,8 +3268,10 @@ static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
			asize = amdkfd_size;

		cmd = ioctl->cmd;
	} else
	} else {
		retcode = -ENOTTY;
		goto err_i1;
	}

	dev_dbg(kfd_device, "ioctl cmd 0x%x (#0x%x), arg 0x%lx\n", cmd, nr, arg);