summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2014-02-22 16:20:04 +0000
committerEmil Velikov <[email protected]>2014-02-24 14:51:45 +0000
commit0e7c30233f10d834ee26b7d6d32b397625e11e10 (patch)
tree919208b7f5792526f2af696138c9714710bbf9ca
parent73c78c514f8db0605c0deb85382003d0f66b5525 (diff)
targets/gbm: exit gracefully if pipe_loader_drm_probe_fd is not available
When one builds without gallium_drm_loader, the above function will not be available, thus we'll segfault in gallium_screen_create due to memory access violation. Tested-by: Tom Stellard <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75335 Signed-off-by: Emil Velikov <[email protected]>
-rw-r--r--src/gallium/targets/gbm/gbm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gallium/targets/gbm/gbm.c b/src/gallium/targets/gbm/gbm.c
index deaa401ad11..160cbb84380 100644
--- a/src/gallium/targets/gbm/gbm.c
+++ b/src/gallium/targets/gbm/gbm.c
@@ -49,13 +49,14 @@ int
gallium_screen_create(struct gbm_gallium_drm_device *gdrm)
{
struct pipe_loader_device *dev;
-#ifdef HAVE_PIPE_LOADER_DRM
- int ret;
+ int ret = 0;
+#ifdef HAVE_PIPE_LOADER_DRM
ret = pipe_loader_drm_probe_fd(&dev, gdrm->base.base.fd, true);
+#endif /* HAVE_PIPE_LOADER_DRM */
+
if (!ret)
return -1;
-#endif /* HAVE_PIPE_LOADER_DRM */
gdrm->screen = pipe_loader_create_screen(dev, get_library_search_path());
if (gdrm->screen == NULL) {