[PATCH i-g-t v3 4/4] lib/igt_sysfs: improve xe sysfs checks
Kamil Konieczny
kamil.konieczny at linux.intel.com
Fri Nov 8 20:18:39 UTC 2024
Improve check for Xe sysfs failed open. While at this, make sure
it will not be closed just before unbind and also use drmtest
close function, as it will properly call xe_device_put().
Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
lib/igt_sysfs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 356b20f29..c414c57e9 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -1376,7 +1376,7 @@ int xe_sysfs_driver_do(int xe_device, char pci_slot[], enum xe_sysfs_driver_acti
int sysfs;
sysfs = open("/sys/bus/pci/drivers/xe", O_DIRECTORY);
- igt_assert(sysfs);
+ igt_assert_f(sysfs != -1, "Sysfs open failed, errno=%d\n", errno);
__drm_invalidate_opened_fds();
switch(action) {
@@ -1399,7 +1399,8 @@ int xe_sysfs_driver_do(int xe_device, char pci_slot[], enum xe_sysfs_driver_acti
* We need to close the client for a proper release, before
* binding back again.
*/
- close(xe_device);
+ igt_assert_neq(xe_device, sysfs);
+ drm_close_driver(xe_device);
igt_assert(igt_sysfs_set(sysfs, "bind", pci_slot));
close(sysfs);
--
2.47.0
More information about the igt-dev
mailing list