intel: Don't close the fd on probe failure if it is server managed
authorHans de Goede <hdegoede@redhat.com>
Tue, 18 Mar 2014 14:16:30 +0000 (15:16 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 18 Mar 2014 15:55:54 +0000 (15:55 +0000)
I hit this corner case when testing a single X server spanning both intel
gfx + an usb display link adapter driven by xf86-video-modesetting.

In this scenario the intel driver gets its platformProbe method called first,
and if it then closes the server managed fd, the xf86-video-modesetting gets
EBADFD errors.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
src/intel_device.c

index e95936b..11118c2 100644 (file)
@@ -339,7 +339,8 @@ int intel_open_device(int entity_num,
        return fd;
 
 err_close:
-       close(fd);
+       if (master_count == 0) /* Don't close server-fds */
+               close(fd);
 err_path:
        free(local_path);
        return -1;