Re: [PATCH 3/6] drm/i915: Propagating correct error codes to the userspace

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

 



On 08/10/15 11:22, Tvrtko Ursulin wrote:

Hi,

On 08/10/15 07:24, ankitprasad.r.sharma@xxxxxxxxx wrote:
From: Ankitprasad Sharma <ankitprasad.r.sharma@xxxxxxxxx>

Propagating correct error codes to userspace by using ERR_PTR and
PTR_ERR macros for stolen memory based object allocation. We generally
return -ENOMEM to the user whenever there is a failure in object
allocation. This patch helps user to identify the correct reason for the
failure and not just -ENOMEM each time.

v2: Moved the patch up in the series, added error propagation for
i915_gem_alloc_object too (Chris)

Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@xxxxxxxxx>
---
  drivers/gpu/drm/i915/i915_gem.c              | 15 +++++-----
  drivers/gpu/drm/i915/i915_gem_batch_pool.c   |  4 +--
  drivers/gpu/drm/i915/i915_gem_context.c      |  4 +--
  drivers/gpu/drm/i915/i915_gem_render_state.c |  4 +--
  drivers/gpu/drm/i915/i915_gem_stolen.c       | 43
++++++++++++++++------------
  drivers/gpu/drm/i915/i915_guc_submission.c   |  4 +--
  drivers/gpu/drm/i915/intel_display.c         |  2 +-
  drivers/gpu/drm/i915/intel_fbdev.c           |  6 ++--
  drivers/gpu/drm/i915/intel_lrc.c             |  8 +++---
  drivers/gpu/drm/i915/intel_overlay.c         |  4 +--
  drivers/gpu/drm/i915/intel_pm.c              |  2 +-
  drivers/gpu/drm/i915/intel_ringbuffer.c      | 20 ++++++-------
  12 files changed, 61 insertions(+), 55 deletions(-)

[snip]

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c
b/drivers/gpu/drm/i915/i915_guc_submission.c
index 792d0b9..3901698 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -646,8 +646,8 @@ static struct drm_i915_gem_object
*gem_allocate_guc_obj(struct drm_device *dev,
      struct drm_i915_gem_object *obj;

      obj = i915_gem_alloc_object(dev, size);
-    if (!obj)
-        return NULL;
+    if (IS_ERR(obj))
+        return obj;

You have to change kerneldoc for this function now.
And even more importantly update error handling in the callers!

Or more simply, stop propagating the specific error at this level (it doesn't really help and probably can't even happen here), making this:

>>       obj = i915_gem_alloc_object(dev, size);
>> -    if (!obj)
>> +    if (IS_ERR(obj))

leaving the "return NULL;" unchanged.

.Dave.
_______________________________________________
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