diff options
author | monk.liu <monk.liu@amd.com> | 2015-05-05 03:24:17 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-05-07 11:00:15 -0400 |
commit | db12973cd581d4e79f4aadd0960948f268d15af7 (patch) | |
tree | 5c373fbc494101b320299d5f9fce475e5d7bbacc /drivers/gpu | |
parent | d73a824acc705571c0f47596326d7967fba9a1d9 (diff) |
drm/radeon: fix userptr BO unpin bug v3
Fixing a memory leak with userptrs.
v2: clean up the loop, use an iterator instead
v3: remove unused variable
Signed-off-by: monk.liu <monk.liu@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
CC: stable@vger.kernel.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ttm.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index b292aca0f342..edafd3c2b170 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -591,8 +591,7 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm) | |||
591 | { | 591 | { |
592 | struct radeon_device *rdev = radeon_get_rdev(ttm->bdev); | 592 | struct radeon_device *rdev = radeon_get_rdev(ttm->bdev); |
593 | struct radeon_ttm_tt *gtt = (void *)ttm; | 593 | struct radeon_ttm_tt *gtt = (void *)ttm; |
594 | struct scatterlist *sg; | 594 | struct sg_page_iter sg_iter; |
595 | int i; | ||
596 | 595 | ||
597 | int write = !(gtt->userflags & RADEON_GEM_USERPTR_READONLY); | 596 | int write = !(gtt->userflags & RADEON_GEM_USERPTR_READONLY); |
598 | enum dma_data_direction direction = write ? | 597 | enum dma_data_direction direction = write ? |
@@ -605,9 +604,8 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm) | |||
605 | /* free the sg table and pages again */ | 604 | /* free the sg table and pages again */ |
606 | dma_unmap_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction); | 605 | dma_unmap_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction); |
607 | 606 | ||
608 | for_each_sg(ttm->sg->sgl, sg, ttm->sg->nents, i) { | 607 | for_each_sg_page(ttm->sg->sgl, &sg_iter, ttm->sg->nents, 0) { |
609 | struct page *page = sg_page(sg); | 608 | struct page *page = sg_page_iter_page(&sg_iter); |
610 | |||
611 | if (!(gtt->userflags & RADEON_GEM_USERPTR_READONLY)) | 609 | if (!(gtt->userflags & RADEON_GEM_USERPTR_READONLY)) |
612 | set_page_dirty(page); | 610 | set_page_dirty(page); |
613 | 611 | ||