diff mbox series

drm/nouveau: fix dma syncing for loops

Message ID 20210308014923.30163-1-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/nouveau: fix dma syncing for loops | expand

Commit Message

Dave Airlie March 8, 2021, 1:49 a.m. UTC
From: Dave Airlie <airlied@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@redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael J. Ruhl March 9, 2021, 1:52 p.m. UTC | #1
>-----Original Message-----
>From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of
>Dave Airlie
>Sent: Sunday, March 7, 2021 8:49 PM
>To: dri-devel@lists.freedesktop.org
>Cc: skeggsb@gmail.com
>Subject: [PATCH] drm/nouveau: fix dma syncing for loops
>
>From: Dave Airlie <airlied@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@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;) {

This took a bit to see how the increment worked.

Would calling it out with a comment be out of line?

With or without the comment:

Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>

M

> 		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
>
>_______________________________________________
>dri-devel mailing list
>dri-devel@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

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;