On Mon, Aug 23, 2021 at 05:50:27PM +1000, Stephen Rothwell wrote: > From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> > Date: Mon, 23 Aug 2021 17:46:27 +1000 > Subject: [PATCH] drm/i915/ttm: fix up for "lib/scatterlist: Provide a > dedicated function to support tableappend" > > Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> > drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > index 771eb2963123..d3d95934a047 100644 > +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > @@ -382,7 +382,6 @@ i915_ttm_region(struct ttm_device *bdev, int ttm_mem_type) > static struct sg_table *i915_ttm_tt_get_st(struct ttm_tt *ttm) > { > struct i915_ttm_tt *i915_tt = container_of(ttm, typeof(*i915_tt), ttm); > - struct scatterlist *sg; > struct sg_table *st; > int ret; > > @@ -393,13 +392,13 @@ static struct sg_table *i915_ttm_tt_get_st(struct ttm_tt *ttm) > if (!st) > return ERR_PTR(-ENOMEM); > > - sg = __sg_alloc_table_from_pages > + ret = sg_alloc_table_from_pages_segment > (st, ttm->pages, ttm->num_pages, 0, > (unsigned long)ttm->num_pages << PAGE_SHIFT, > - i915_sg_segment_size(), NULL, 0, GFP_KERNEL); > - if (IS_ERR(sg)) { > + i915_sg_segment_size(), GFP_KERNEL); > + if (ret) { > kfree(st); > - return ERR_CAST(sg); > + return ERR_PTR(ret); > } Looks right, thanks Jason