Re: [PATCH] Fix pointer tests in error-handling paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 22/01/16 12:19, Dave Gordon wrote:
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@xxxxxxxxx>
Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
---
  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +-
  drivers/gpu/drm/i915/intel_display.c       | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

Not sure if CI will pick up a new patch in an old series.

Anyway:

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

Regards,

Tvrtko


diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 2dc08ce..a7bd555 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1654,7 +1654,7 @@ static bool only_mappable_for_reloc(unsigned int flags)
  	 * 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);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8104511..b88cdac 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -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);

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux