From: Alyssa Rosenzweig Date: Wed, 21 Aug 2019 16:33:39 +0000 (-0700) Subject: panfrost: Hoist bo != NULL check before dereference X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c43fa6b3209b229ac7b31fa7ce49a556f1c4d7ad;p=mesa.git panfrost: Hoist bo != NULL check before dereference Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c index 28a4287202b..8ee39c52d4a 100644 --- a/src/gallium/drivers/panfrost/pan_drm.c +++ b/src/gallium/drivers/panfrost/pan_drm.c @@ -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 */