Module: Mesa
Branch: master
Commit: 9adbb9e7134fdc40766710592e81cbc9c09c7aaa
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9adbb9e7134fdc40766710592e81cbc9c09c7aaa

Author: Tom Stellard <thomas.stell...@amd.com>
Date:   Sat Nov 28 02:40:24 2015 +0000

clover: Handle NULL devices returned by pipe_loader_probe() v2

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.

When a device disappears, the pipe_loader_probe() will add a NULL
device to the device list, so we need to handle this.

v2:
  - Keep range for loop

Reviewed-by: Francisco Jerez <curroje...@riseup.net>
Acked-by: Emil Velikov <emil.l.veli...@gmail.com>

CC: <mesa-sta...@lists.freedesktop.org>

---

 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);
       }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to