[Mesa-dev] [PATCH] radv: Properly handle destroying NULL devices and instances

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Mon Mar 6 08:00:30 UTC 2017


Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

On Mon, Mar 6, 2017 at 8:17 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> Ported from anv:
> 3d33a23e anv: Properly handle destroying NULL devices and instances
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/amd/vulkan/radv_device.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index 58f37c6..ab04473 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -365,6 +365,9 @@ void radv_DestroyInstance(
>  {
>         RADV_FROM_HANDLE(radv_instance, instance, _instance);
>
> +       if (!instance)
> +               return;
> +
>         for (int i = 0; i < instance->physicalDeviceCount; ++i) {
>                 radv_physical_device_finish(instance->physicalDevices + i);
>         }
> @@ -988,6 +991,9 @@ void radv_DestroyDevice(
>  {
>         RADV_FROM_HANDLE(radv_device, device, _device);
>
> +       if (!device)
> +               return;
> +
>         if (device->trace_bo)
>                 device->ws->buffer_destroy(device->trace_bo);
>
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list