[PATCH i-g-t v2 5/8] tests/core_hotunplug: Fix device close

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Aug 5 14:37:08 UTC 2024


Use __drm_close_driver() for closing a drm device, as it was
opened with __drm_open_driver() function.

v2: update description

Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda at intel.com>
---
 tests/core_hotunplug.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index cc715a234..b66d5e4cf 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -142,7 +142,11 @@ static int close_device(int fd_drm, const char *when, const char *which)
 		return fd_drm;
 
 	local_debug("%sclosing %sdevice instance\n", when, which);
-	return local_close(fd_drm, "Device close failed");
+	errno = 0;
+	if (igt_warn_on_f(__drm_close_driver(fd_drm), "Device close failed\n"))
+		return -errno;	/* (never -1) */
+
+	return -1;	/* success */
 }
 
 static int close_sysfs(int fd_sysfs_dev)
-- 
2.43.0



More information about the igt-dev mailing list