summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-08-15 10:24:08 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-08-16 09:57:53 +0100
commita3228b340c52f4ad2bf35af866f77603fe2d25d8 (patch)
treebdd8a4cf2afc45e82c96a344628c34ca8e854bc1
parent940cb5f46433a8ae48d21c6672e4d8ecd1358bbf (diff)
igt/pm_rpm: Close local fd before trying to unload module
Make sure everything we open in setup_environment() is paired to teardown_environment(). Fixes: d8e78990aa2b ("igt/pm_rpm: Test reaquisition of runtime-pm after module reload") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Imre Deak <imre.deak@intel.com>
-rw-r--r--tests/pm_rpm.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 65489bcd..c0212ed7 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -717,21 +717,23 @@ out:
return wait_for_suspended();
}
-static void restore_environment(void)
+static void teardown_environment(void)
{
+ close(msr_fd);
+ if (has_pc8)
+ close(pc8_status_fd);
+
+ igt_restore_runtime_pm();
+
igt_pm_restore_sata_link_power_management(pm_data);
free(pm_data);
-}
-static void teardown_environment(void)
-{
- restore_environment();
fini_mode_set_data(&ms_data);
+
close(debugfs);
- drmClose(drm_fd);
- close(msr_fd);
- if (has_pc8)
- close(pc8_status_fd);
+ close(drm_fd);
+
+ has_runtime_pm = false;
}
static void basic_subtest(void)