summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2015-06-30 15:53:27 +0100
committerEmil Velikov <[email protected]>2015-07-13 19:56:39 +0100
commita27ec5dc460b91dc44675f48cddbbb2631ee824f (patch)
tree8d5a7149b7b5dcccd394cd184b0f894d083f666e /src/gallium/auxiliary
parent69a1b9959e59653da262185c4e2cf57d24939b19 (diff)
pipe-loader: simplify pipe_loader_drm_probe
Do not iterate and (attempt to) open the render device, if we're over the requested number of devices. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 009e1dfdf6f..1ff5f3e8df8 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -180,12 +180,13 @@ open_drm_render_node_minor(int minor)
int
pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
{
+ struct pipe_loader_device *dev;
int i, j, fd;
for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
- i <= DRM_RENDER_NODE_MAX_MINOR; i++) {
+ i <= DRM_RENDER_NODE_MAX_MINOR && j < ndev; i++) {
+
fd = open_drm_render_node_minor(i);
- struct pipe_loader_device *dev;
if (fd < 0)
continue;
@@ -194,13 +195,7 @@ pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
continue;
}
- if (j < ndev) {
- devs[j] = dev;
- } else {
- close(fd);
- dev->ops->release(&dev);
- }
- j++;
+ devs[j++] = dev;
}
return j;