[PATCH i-g-t 7/8] tests/intel/kms_pipe_stress: Eliminate double display.drm_fd initialization

Ville Syrjala
2026-01-13T12:05:11Z

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Stop initializing display.drm_fd twice. The first one
is done explicitly and the second time is done by
igt_display_require(). Just rely on igt_display_require().

Note that a bunch of other tests do still do something similar
by completely omitting the local fd varaible/member and just
using display.drm_fd everywhere. It's a somewhat strange way
to do things, but I decided to leave those alone at least for
now.

Done with cocci:
#include "scripts/iterators.cocci"

@@
expression DISPLAY;
expression FD, E;
@@
- FD = DISPLAY.drm_fd = E;
+ FD = E;
...
(
igt_display_require(&DISPLAY, FD)
|
igt_display_require(&DISPLAY,
- DISPLAY.drm_fd
+ FD
)
)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/intel/kms_pipe_stress.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/intel/kms_pipe_stress.c b/tests/intel/kms_pipe_stress.c
index e8e01556ba25..33ccac9fcee3 100644
--- a/tests/intel/kms_pipe_stress.c
+++ b/tests/intel/kms_pipe_stress.c
@@ -862,11 +862,11 @@ int igt_main() {
uint8_t format_idx = 0, tiling_idx = 0;

igt_fixture() {
- data.drm_fd = data.display.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
+ data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);

kmstest_set_vt_graphics_mode();

- igt_display_require(&data.display, data.display.drm_fd);
+ igt_display_require(&data.display, data.drm_fd);
igt_require(data.display.is_atomic);
igt_display_require_output(&data.display);
data.devid = intel_get_drm_devid(data.drm_fd);
--
2.51.2