diff options
| author | Rob Herring <robh@kernel.org> | 2016-10-21 10:07:59 -0700 |
|---|---|---|
| committer | Eric Anholt <eric@anholt.net> | 2016-10-21 12:50:50 -0700 |
| commit | 677cd97dc4a930af508388713f5016baf664ed18 (patch) | |
| tree | 4f471e9b8c1fab8d8995cda5135f5f55f999476f | |
| parent | 7dd28475f129300e67838cb7cba5ce098bc6c0a7 (diff) | |
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>
| -rw-r--r-- | xf86drm.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -3181,6 +3181,8 @@ int drmGetDevice(int fd, drmDevicePtr *device) closedir(sysdir); free(local_devices); + if (*device == NULL) + return -ENODEV; return 0; free_devices: |
