[igt-dev] [PATCH i-g-t] lib/igt_gt: Move assert with setting 'reset' parameter after IGT env check

Katarzyna Dec
2019-01-23T14:04:09Z

We are trying to set reset parameter earlier than checking IGT env.
Let's move it after checking IGT env to avoid setting reset parameter
when hang injection is disabled.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
---
lib/igt_gt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index dd28d821..64669672 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -170,15 +170,15 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
*/
igt_require_gem(fd);

- igt_assert(igt_sysfs_set_parameter
- (fd, "reset", "%d", INT_MAX /* any reset method */));
-
if (!igt_check_boolean_env_var("IGT_HANG", true))
igt_skip("hang injection disabled by user");
gem_context_require_bannable(fd);
if (!igt_check_boolean_env_var("IGT_HANG_WITHOUT_RESET", false))
igt_require(has_gpu_reset(fd));

+ igt_assert(igt_sysfs_set_parameter
+ (fd, "reset", "%d", INT_MAX /* any reset method */));
+
if ((flags & HANG_ALLOW_CAPTURE) == 0) {
param.param = I915_CONTEXT_PARAM_NO_ERROR_CAPTURE;
param.value = 1;
--
2.17.2