winsys/amdgpu: clean up error paths in amdgpu_winsys_create
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 6 Sep 2016 13:10:06 +0000 (15:10 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 12 Sep 2016 11:54:53 +0000 (13:54 +0200)
No need to call pb_cache_deinit, because the cache hasn't been initialized
at that point.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c

index 33aa49291377edbf26080567c248de0595b539d7..521a78a08afa87da487e9e6a5724cf2eff29ee1c 100644 (file)
@@ -527,17 +527,15 @@ amdgpu_winsys_create(int fd, radeon_screen_create_t screen_create)
 
    /* Create a new winsys. */
    ws = CALLOC_STRUCT(amdgpu_winsys);
-   if (!ws) {
-      pipe_mutex_unlock(dev_tab_mutex);
-      return NULL;
-   }
+   if (!ws)
+      goto fail;
 
    ws->dev = dev;
    ws->info.drm_major = drm_major;
    ws->info.drm_minor = drm_minor;
 
    if (!do_winsys_init(ws, fd))
-      goto fail;
+      goto fail_alloc;
 
    /* Create managers. */
    pb_cache_init(&ws->bo_cache, 500000, ws->check_vm ? 1.0f : 2.0f, 0,
@@ -587,9 +585,9 @@ amdgpu_winsys_create(int fd, radeon_screen_create_t screen_create)
 
    return &ws->base;
 
+fail_alloc:
+   FREE(ws);
 fail:
    pipe_mutex_unlock(dev_tab_mutex);
-   pb_cache_deinit(&ws->bo_cache);
-   FREE(ws);
    return NULL;
 }