Fix pointer tests in error-handling paths
authorDave Gordon <david.s.gordon@intel.com>
Thu, 28 Jan 2016 10:48:09 +0000 (10:48 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 28 Jan 2016 17:42:14 +0000 (17:42 +0000)
In the error-handling paths of i915_gem_do_execbuffer() and
intel_crtc_page_flip(), the local pointer-to-request variables
were expected to be either valid pointers or NULL. Since

  2682708 drm/i915: simplify allocation of driver-internal requests

they could also be ERR_PTR() values, so the tests need to be
updated to accommodate this case.

Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453978089-29127-1-git-send-email-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_gem_execbuffer.c
drivers/gpu/drm/i915/intel_display.c

index 5cb57f642ac131cd5192ccf94bd068196fe3cf39..8fd00d2794478cd08e46986ffa03ae88a4e351e5 100644 (file)
@@ -1655,7 +1655,7 @@ err:
         * must be freed again. If it was submitted then it is being tracked
         * on the active request list and no clean up is required here.
         */
-       if (ret && req)
+       if (ret && !IS_ERR_OR_NULL(req))
                i915_gem_request_cancel(req);
 
        mutex_unlock(&dev->struct_mutex);
index 8104511ad30278443e5a65557aa6692eff2eab44..b88cdac747ebdd6df5f82e539fa728aa60e9deda 100644 (file)
@@ -11726,7 +11726,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 cleanup_unpin:
        intel_unpin_fb_obj(fb, crtc->primary->state);
 cleanup_pending:
-       if (request)
+       if (!IS_ERR_OR_NULL(request))
                i915_gem_request_cancel(request);
        atomic_dec(&intel_crtc->unpin_work_count);
        mutex_unlock(&dev->struct_mutex);