[PATCH i-g-t v4 4/4] lib/igt_sysfs: improve xe sysfs checks
Kamil Konieczny
kamil.konieczny at linux.intel.com
Tue Nov 26 18:10:23 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 e903a9857..850ca21b4 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -1447,7 +1447,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) {
@@ -1470,7 +1470,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.34.1
More information about the igt-dev
mailing list