Skip to content

Commit a81bfc0

Browse files
Villemoesgregkh
authored andcommitted
drm/radeon: use post-decrement in error handling
commit bc3f5d8 upstream. We need to use post-decrement to get the pci_map_page undone also for i==0, and to avoid some very unpleasant behaviour if pci_map_page failed already at i==0. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8d5e1e5 commit a81bfc0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpu/drm/radeon/radeon_ttm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm)
619619
0, PAGE_SIZE,
620620
PCI_DMA_BIDIRECTIONAL);
621621
if (pci_dma_mapping_error(rdev->pdev, gtt->ttm.dma_address[i])) {
622-
while (--i) {
622+
while (i--) {
623623
pci_unmap_page(rdev->pdev, gtt->ttm.dma_address[i],
624624
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
625625
gtt->ttm.dma_address[i] = 0;

0 commit comments

Comments
 (0)