[Intel-gfx] [PATCH 3/6] drm/i915: Propagating correct error codes to the userspace
Dave Gordon
david.s.gordon at intel.com
Fri Oct 9 08:13:24 PDT 2015
On 08/10/15 11:22, Tvrtko Ursulin wrote:
>
> Hi,
>
> On 08/10/15 07:24, ankitprasad.r.sharma at intel.com wrote:
>> From: Ankitprasad Sharma <ankitprasad.r.sharma at intel.com>
>>
>> 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 at intel.com>
>> ---
>> 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.
More information about the Intel-gfx
mailing list