When probing for devices, clover will call pipe_loader_probe() twice. The first time to retrieve the number of devices, and then second time to retrieve the device structures.
We currently assume that the return value of both calls will be the same, but this will not be the case if a device happens to disappear between the two calls. This patch removes this assumption and checks the return value of the second pipe_loader_probe() call to ensure it does not try to initialize devices that no longer exits. CC: <mesa-sta...@lists.freedesktop.org> v2: - Keep range for loop --- src/gallium/state_trackers/clover/core/platform.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/clover/core/platform.cpp b/src/gallium/state_trackers/clover/core/platform.cpp index 328b71c..489e8dc 100644 --- a/src/gallium/state_trackers/clover/core/platform.cpp +++ b/src/gallium/state_trackers/clover/core/platform.cpp @@ -32,7 +32,8 @@ platform::platform() : adaptor_range(evals(), devs) { for (pipe_loader_device *ldev : ldevs) { try { - devs.push_back(create<device>(*this, ldev)); + if (ldev) + devs.push_back(create<device>(*this, ldev)); } catch (error &) { pipe_loader_release(&ldev, 1); } -- 2.0.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev