aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Herring2016-10-21 12:07:59 -0500
committerEric Anholt2016-10-21 14:50:50 -0500
commit677cd97dc4a930af508388713f5016baf664ed18 (patch)
tree4f471e9b8c1fab8d8995cda5135f5f55f999476f /xf86drm.c
parent7dd28475f129300e67838cb7cba5ce098bc6c0a7 (diff)
downloadexternal-libgbm-677cd97dc4a930af508388713f5016baf664ed18.tar.gz
external-libgbm-677cd97dc4a930af508388713f5016baf664ed18.tar.xz
external-libgbm-677cd97dc4a930af508388713f5016baf664ed18.zip
Return an -ENODEV from drmGetDevice() when no device was found.
Fixes crashes in Mesa on platform devices, which expected *device to have a device when 0 was returned. (code from a paste by Rob, commit message by anholt) Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'xf86drm.c')
-rw-r--r--xf86drm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/xf86drm.c b/xf86drm.c
index 9cfca49d..9b52889e 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3181,6 +3181,8 @@ int drmGetDevice(int fd, drmDevicePtr *device)
3181 3181
3182 closedir(sysdir); 3182 closedir(sysdir);
3183 free(local_devices); 3183 free(local_devices);
3184 if (*device == NULL)
3185 return -ENODEV;
3184 return 0; 3186 return 0;
3185 3187
3186free_devices: 3188free_devices: