On Tue, 27 Jul 2010 10:00:07 +0800, Zhenyu Wang <zhen...@linux.intel.com> wrote:
> On 2010.07.24 18:29:37 +0100, Chris Wilson wrote:
> > A side-effect of being able to use custom page allocations with the
> > sg_table is that it cannot reap the partially constructed scatterlist if
> > fails to allocate a page. So we need to call sg_free_table() ourselves
> > if sg_alloc_table() fails.
> 
> Why? Doesn't sg_alloc_table() handle the failure case to call sg_free_table()
> already?

sg_alloc_table() is just a wrapper around __sg_alloc_table() that passes
in the default alloc_func. So for __sg_alloc_table() to do the cleanup we
would need to also pass in the free_func. Since it doesn't, it can't free
the partially constructed table. So to fix this we have the choice of
changing the interface (and add extra overhead to the common path) or
trivially rearrange our failure path.
-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to