[PATCH] drm/nouveau: fix dma syncing for loops

Dave Airlie airlied at gmail.com
Mon Mar 8 01:49:23 UTC 2021


From: Dave Airlie <airlied at redhat.com>

The index variable should only be increased in one place.

Noticed this while trying to track down another oops.

Fixes: f295c8cfec83 ("drm/nouveau: fix dma syncing warning with debugging on.")
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 2375711877cf..4f693843def5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -556,7 +556,7 @@ nouveau_bo_sync_for_device(struct nouveau_bo *nvbo)
 	if (nvbo->force_coherent)
 		return;
 
-	for (i = 0; i < ttm_dma->num_pages; ++i) {
+	for (i = 0; i < ttm_dma->num_pages;) {
 		struct page *p = ttm_dma->pages[i];
 		size_t num_pages = 1;
 
@@ -587,7 +587,7 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo *nvbo)
 	if (nvbo->force_coherent)
 		return;
 
-	for (i = 0; i < ttm_dma->num_pages; ++i) {
+	for (i = 0; i < ttm_dma->num_pages;) {
 		struct page *p = ttm_dma->pages[i];
 		size_t num_pages = 1;
 
-- 
2.27.0



More information about the dri-devel mailing list