xf86drm: Fix error path in drmGetDevice2
authorMariusz Ceier <mceier+mesa-dev@gmail.com>
Sun, 29 Jul 2018 08:20:14 +0000 (10:20 +0200)
committerMichel Dänzer <michel.daenzer@amd.com>
Mon, 30 Jul 2018 10:21:32 +0000 (12:21 +0200)
commit4519db23ef716f37f804485f50955c26c38a6ae6
tree284817499a8eaaebbba4c815d024d00f3053ce2d
parent9c979e0ec4052acc93da94f477c3d3d6139ebd31
xf86drm: Fix error path in drmGetDevice2

In drmGetDevice2 when no local device is found or when
drm_device_has_rdev filters out all devices, *device might be left
uninitialized causing drmGetDevice2 to not return error - since
it's only returned when *device == NULL.

Above leads to crash in the firefox in system with amdgpu.

With this change firefox displays:

libGL error: MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu
libGL error: MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu

and doesn't crash.

Bugzilla: https://bugs.freedesktop.org/107384
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Mariusz Ceier <mceier+mesa-dev@gmail.com>
xf86drm.c