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 Wed, Nov 11, 2015 at 04:06:10PM +0530, ankitprasad.r.sharma@xxxxxxxxx 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
_______________________________________________
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