[Intel-gfx] [PATCH 06/11] drm/i915: Propagating correct error codes to the userspace

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 14 02:25:45 PST 2016


On Thu, Jan 14, 2016 at 11:46:42AM +0530, ankitprasad.r.sharma at intel.com wrote:
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 6a429c0..b7dcd21 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -396,19 +396,18 @@ i915_gem_alloc_object_stolen(struct drm_device *dev, size_t size)
>  
>  	mutex_lock(&dev->struct_mutex);
>  	obj = i915_gem_object_create_stolen(dev, size);
> -	if (!obj) {
> -		mutex_unlock(&dev->struct_mutex);
> -		return NULL;
> -	}
> +	if (IS_ERR(obj))
> +		goto out;
>  
>  	/* Always clear fresh buffers before handing to userspace */
>  	ret = i915_gem_object_clear(obj);
>  	if (ret) {
>  		drm_gem_object_unreference(&obj->base);
>  		mutex_unlock(&dev->struct_mutex);
> -		return NULL;
> +		return ERR_PTR(ret);

ret = i915_gem_object_clear(obj);
if (ret) {
	drm_gem_object_unreference(&obj->base);
	obj = ERR_PTR(ret);
	goto out;
}

>  	}
>  
> +out:
>  	mutex_unlock(&dev->struct_mutex);
>  	return obj;
>  }

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list