[Mesa-stable] [PATCH] clover: Check the return value of pipe_loader_probe() when probing for devices v2

Francisco Jerez currojerez at riseup.net
Tue Dec 1 02:41:44 PST 2015


Tom Stellard <thomas.stellard at amd.com> writes:

> 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

Thanks,
Reviewed-by: Francisco Jerez <currojerez at riseup.net>

> ---
>  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-stable mailing list
> mesa-stable at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-stable/attachments/20151201/e26199ec/attachment-0001.sig>


More information about the mesa-stable mailing list