|
@@ -35,8 +35,10 @@ static void internal_free_pages(struct sg_table *st)
|
|
{
|
|
{
|
|
struct scatterlist *sg;
|
|
struct scatterlist *sg;
|
|
|
|
|
|
- for (sg = st->sgl; sg; sg = __sg_next(sg))
|
|
|
|
- __free_pages(sg_page(sg), get_order(sg->length));
|
|
|
|
|
|
+ for (sg = st->sgl; sg; sg = __sg_next(sg)) {
|
|
|
|
+ if (sg_page(sg))
|
|
|
|
+ __free_pages(sg_page(sg), get_order(sg->length));
|
|
|
|
+ }
|
|
|
|
|
|
sg_free_table(st);
|
|
sg_free_table(st);
|
|
kfree(st);
|
|
kfree(st);
|
|
@@ -116,6 +118,7 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
|
|
return st;
|
|
return st;
|
|
|
|
|
|
err:
|
|
err:
|
|
|
|
+ sg_set_page(sg, NULL, 0, 0);
|
|
sg_mark_end(sg);
|
|
sg_mark_end(sg);
|
|
internal_free_pages(st);
|
|
internal_free_pages(st);
|
|
return ERR_PTR(-ENOMEM);
|
|
return ERR_PTR(-ENOMEM);
|