From b67bc6fcc901ab3a2e18d23c40ea97986e93dc71 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Thu, 30 Sep 2021 03:08:06 -0500 Subject: [PATCH] Check errno rather than return from kmtIoctl in hsaKmtRuntimeEnable. The return code is just -1 if any error occurs. To detect debugger unavailable we need to check the actual ioctl error code. Change-Id: I8a294c754196aec916809497ec8e810da2f072b8 Signed-off-by: Sean Keely --- src/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index c2f0546b90..d2879e6a60 100644 --- a/src/debug.c +++ b/src/debug.c @@ -324,7 +324,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtRuntimeEnable(void *rDebug, long err = kmtIoctl(kfd_fd, AMDKFD_IOC_DBG_TRAP, &args); if (err) { - if (err == EBUSY) + if (errno == EBUSY) return HSAKMT_STATUS_UNAVAILABLE; else return HSAKMT_STATUS_ERROR;