From: Tom Stellard Date: Sat, 28 Nov 2015 02:40:24 +0000 (+0000) Subject: clover: Handle NULL devices returned by pipe_loader_probe() v2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9adbb9e7134fdc40766710592e81cbc9c09c7aaa;p=mesa.git 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 Acked-by: Emil Velikov CC: --- diff --git a/src/gallium/state_trackers/clover/core/platform.cpp b/src/gallium/state_trackers/clover/core/platform.cpp index 328b71cdcb1..489e8dc5a83 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(*this, ldev)); + if (ldev) + devs.push_back(create(*this, ldev)); } catch (error &) { pipe_loader_release(&ldev, 1); }