Re: [PATCH 42/49] drm/i915/bdw: Get prepared for a two-stage execlist submit process

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

 



On Fri, Apr 04, 2014 at 12:12:35PM +0100, Damien Lespiau wrote:
> On Thu, Mar 27, 2014 at 06:00:11PM +0000, oscar.mateo@xxxxxxxxx wrote:
> > +int gen8_switch_context_queue(struct intel_engine *ring,
> > +			      struct i915_hw_context *to,
> > +			      u32 tail)
> > +{
> > +	struct drm_i915_gem_request *req = NULL;
> > +	unsigned long flags;
> > +	bool was_empty;
> > +
> > +	req = (struct drm_i915_gem_request *)
> > +		kmalloc(sizeof(struct drm_i915_gem_request), GFP_KERNEL);
> > +	req->ring = ring;
> > +	req->ctx = to;
> > +	i915_gem_context_reference(req->ctx);
> > +	req->tail = tail;
> 
> Need to test if the allocation has succeeded and return an error if not.

Also, no need for the cast, kmalloc returns a void *.

We usually use sizeof(*req) to be safe against variables changing type
without updating the allocation size (someont the compiler wouldn't warn
about).

-- 
Damien
_______________________________________________
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