[Mesa-stable] [PATCH] clover: Check the return value of pipe_loader_probe() when probing for devices v2
Emil Velikov
emil.l.velikov at gmail.com
Tue Dec 1 08:58:38 PST 2015
On 30 November 2015 at 17:50, Tom Stellard <thomas.stellard at amd.com> wrote:
> 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-stable at 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);
> }
Acked-by: Emil Velikov <emil.l.velikov at gmail.com>
-Emil
More information about the mesa-stable
mailing list