diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2016-02-15 13:41:46 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-02-18 22:36:05 -0500 |
commit | 4fbbed46dca83bcba3a0170205110a06c116a8e6 (patch) | |
tree | 446e525b609222a41fb398993131b9a5d25e1abd | |
parent | 5fff80bbdb6b84a94f90391ba674471d37b57eb2 (diff) |
drm/nouveau: use post-decrement in error handling
We need to use post-decrement to get the dma_map_page undone also for
i==0, and to avoid some very unpleasant behaviour if dma_map_page
failed already at i==0.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 78f520d05de9..e3acc35e3805 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -1520,7 +1520,7 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm) | |||
1520 | DMA_BIDIRECTIONAL); | 1520 | DMA_BIDIRECTIONAL); |
1521 | 1521 | ||
1522 | if (dma_mapping_error(pdev, addr)) { | 1522 | if (dma_mapping_error(pdev, addr)) { |
1523 | while (--i) { | 1523 | while (i--) { |
1524 | dma_unmap_page(pdev, ttm_dma->dma_address[i], | 1524 | dma_unmap_page(pdev, ttm_dma->dma_address[i], |
1525 | PAGE_SIZE, DMA_BIDIRECTIONAL); | 1525 | PAGE_SIZE, DMA_BIDIRECTIONAL); |
1526 | ttm_dma->dma_address[i] = 0; | 1526 | ttm_dma->dma_address[i] = 0; |