From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [PATCH 1/6] drm/i915: Allow late allocation of request for i915_add_request() Date: Thu, 12 Jul 2012 18:56:41 +0100 Message-ID: <1342115811_2017@CP5-2952> References: <1342106019-17806-1-git-send-email-chris@chris-wilson.co.uk> <1342106019-17806-2-git-send-email-chris@chris-wilson.co.uk> <20120712174347.GL5039@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from fireflyinternet.com (smtp.fireflyinternet.com [109.228.6.236]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C467A0F8F for ; Thu, 12 Jul 2012 10:56:54 -0700 (PDT) In-Reply-To: <20120712174347.GL5039@phenom.ffwll.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Daniel Vetter Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Thu, 12 Jul 2012 19:43:47 +0200, Daniel Vetter wrote: > On Thu, Jul 12, 2012 at 04:13:34PM +0100, Chris Wilson wrote: > > ret = ring->add_request(ring, &seqno); > > if (ret) > > - return ret; > > + return ret; > > + > > + if (request == NULL) { > > + request = kmalloc(sizeof(*request), GFP_KERNEL); > > + if (request == NULL) > > + return -ENOMEM; > > + } > > Hm, shouldn't we try to allocate the request struct before we emit the > request? Otherwise looks good. I considered the ordering immaterial so went with the cleanest error path. If the allocation fails after we add the breadcrumb, we will then reuse the olr for further batches.... Oops. I was wrong, it matters. -Chris -- Chris Wilson, Intel Open Source Technology Centre