diff mbox

[i-g-t,1/2] aubdump: initialize on descriptor interception

Message ID 20170129233542.7246-1-lionel.g.landwerlin@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lionel Landwerlin Jan. 29, 2017, 11:35 p.m. UTC
Nothing should happen before than given that drm_fd will be set to -1.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 tools/aubdump.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox

Patch

diff --git a/tools/aubdump.c b/tools/aubdump.c
index 6715a5d7..d53addc2 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -594,14 +594,13 @@  ioctl(int fd, unsigned long request, ...)
 	if (_IOC_TYPE(request) == DRM_IOCTL_BASE &&
 	    drm_fd != fd && fstat(fd, &buf) == 0 &&
 	    (buf.st_mode & S_IFMT) == S_IFCHR && major(buf.st_rdev) == DRM_MAJOR) {
+		maybe_init();
 		drm_fd = fd;
 		if (verbose)
 			printf("[intel_aubdump: intercept drm ioctl on fd %d]\n", fd);
 	}
 
 	if (fd == drm_fd) {
-		maybe_init();
-
 		switch (request) {
 		case DRM_IOCTL_I915_GETPARAM: {
 			struct drm_i915_getparam *getparam = argp;