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

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 11 04:12:01 PST 2015


On Wed, Nov 11, 2015 at 04:06:10PM +0530, ankitprasad.r.sharma at intel.com wrote:
> @@ -4399,14 +4399,15 @@ struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
>  	struct drm_i915_gem_object *obj;
>  	struct address_space *mapping;
>  	gfp_t mask;
> +	int ret = 0;

No need for this initialisation.
>  
>  	obj = i915_gem_object_alloc(dev);
>  	if (obj == NULL)
> -		return NULL;
> +		return ERR_PTR(-ENOMEM);
>  
> -	if (drm_gem_object_init(dev, &obj->base, size) != 0) {
> +	if ((ret = drm_gem_object_init(dev, &obj->base, size)) != 0) {

It is considered bad form to do assignments inside the predicate.
ret = drm_gem_object_init(dev, &obj->base, size);
if (ret) {
>  		i915_gem_object_free(obj);
> -		return NULL;
> +		return ERR_PTR(ret);
>  	}

That's the only nit I found.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list