[PATCH i-g-t v2 2/3] lib/igt_kmod: Make sure errno is not already set before unbinding
Daniele Ceraolo Spurio
daniele.ceraolospurio at intel.com
Thu Dec 19 23:05:16 UTC 2024
We assert that errno is zero after unbinding, so we need to make sure it
wasn't already non-zero beforehand or we might incorrectly fail.
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
---
The non-zero starting errno hitting the assert is reproed when using
unbind in the 1915 reload-with-fault-injection test:
https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_12349/shard-snb5/igt@i915_module_load@reload-with-fault-injection.html
lib/igt_kmod.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index d73cb4101..a008b3c29 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -662,6 +662,8 @@ int igt_kmod_unbind(const char *mod_name)
int dirlen;
DIR *dir;
+ errno = 0;
+
dirlen = snprintf(path, sizeof(path), "/sys/module/%s/drivers/pci:%s/",
mod_name, mod_name);
igt_assert(dirlen < sizeof(path));
--
2.43.0
More information about the igt-dev
mailing list