panfrost: Hoist bo != NULL check before dereference
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 21 Aug 2019 16:33:39 +0000 (09:33 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 21 Aug 2019 17:38:31 +0000 (10:38 -0700)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_drm.c

index 28a4287202bd4b2aff397dd7d70ba342f33463b0..8ee39c52d4a75c8fd5ea669b283f34efe46af866 100644 (file)
@@ -154,12 +154,12 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, size_t size,
 void
 panfrost_drm_release_bo(struct panfrost_screen *screen, struct panfrost_bo *bo, bool cacheable)
 {
-        struct drm_gem_close gem_close = { .handle = bo->gem_handle };
-        int ret;
-
         if (!bo)
                 return;
 
+        struct drm_gem_close gem_close = { .handle = bo->gem_handle };
+        int ret;
+
         /* Rather than freeing the BO now, we'll cache the BO for later
          * allocations if we're allowed to */