[PATCH i-g-t 3/4] lib/igt_sysfs: Move close to be common to all actions
Lucas De Marchi
lucas.demarchi at intel.com
Wed Dec 18 05:13:23 UTC 2024
In all cases, close the sysfs dir (except when asserting, which is then
pointless as the test is dying), so move the close to a single place.
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
lib/igt_sysfs.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 9427767b0..a1161b68b 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -1513,15 +1513,12 @@ int xe_sysfs_driver_do(int xe_device, char pci_slot[], enum xe_sysfs_driver_acti
switch(action) {
case XE_SYSFS_DRIVER_BIND:
igt_assert(igt_sysfs_set(sysfs, "bind", pci_slot));
- close(sysfs);
break;
case XE_SYSFS_DRIVER_TRY_BIND:
igt_sysfs_set(sysfs, "bind", pci_slot);
- close(sysfs);
break;
case XE_SYSFS_DRIVER_UNBIND:
igt_assert(igt_sysfs_set(sysfs, "unbind", pci_slot));
- close(sysfs);
break;
case XE_SYSFS_DRIVER_REBIND:
igt_assert(igt_sysfs_set(sysfs, "unbind", pci_slot));
@@ -1533,7 +1530,6 @@ int xe_sysfs_driver_do(int xe_device, char pci_slot[], enum xe_sysfs_driver_acti
__drm_close_driver(xe_device);
igt_assert(igt_sysfs_set(sysfs, "bind", pci_slot));
- close(sysfs);
/* Renew the client connection */
xe_device = drm_open_driver(DRIVER_XE);
@@ -1544,6 +1540,8 @@ int xe_sysfs_driver_do(int xe_device, char pci_slot[], enum xe_sysfs_driver_acti
igt_assert(!"missing");
}
+ close(sysfs);
+
return xe_device;
}
--
2.47.0
More information about the igt-dev
mailing list