loader: fds can be 0
authorDave Airlie <airlied@gmail.com>
Mon, 1 Sep 2014 09:44:19 +0000 (19:44 +1000)
committerDave Airlie <airlied@gmail.com>
Sat, 6 Sep 2014 00:24:25 +0000 (10:24 +1000)
Possible resource leak reported by coverity.

Reported-by: Coverity scanner.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/loader/loader.c

index 47e1f58746ce6c4ded590783524919026ce3bb16..bdd39069149c950cdcd7e8fd8ba89ce6fa150463 100644 (file)
@@ -402,7 +402,7 @@ int loader_get_user_preferred_fd(int default_fd, int *different_device)
    }
 
    fd = drm_open_device(device_name);
-   if (fd > 0) {
+   if (fd >= 0) {
       close(default_fd);
    } else {
       fd = default_fd;