All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: fix dma syncing for loops (v2)
@ 2021-03-11  4:35 Dave Airlie
  2021-03-11 12:42 ` Ruhl, Michael J
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Airlie @ 2021-03-11  4:35 UTC (permalink / raw)
  To: dri-devel; +Cc: michael.j.ruhl, skeggsb

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.

v2: use while loop.

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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] drm/nouveau: fix dma syncing for loops (v2)
  2021-03-11  4:35 [PATCH] drm/nouveau: fix dma syncing for loops (v2) Dave Airlie
@ 2021-03-11 12:42 ` Ruhl, Michael J
  0 siblings, 0 replies; 2+ messages in thread
From: Ruhl, Michael J @ 2021-03-11 12:42 UTC (permalink / raw)
  To: Dave Airlie, dri-devel@lists.freedesktop.org; +Cc: skeggsb@gmail.com

>-----Original Message-----
>From: Dave Airlie <airlied@gmail.com>
>Sent: Wednesday, March 10, 2021 11:35 PM
>To: dri-devel@lists.freedesktop.org
>Cc: Ruhl, Michael J <michael.j.ruhl@intel.com>; skeggsb@gmail.com
>Subject: [PATCH] drm/nouveau: fix dma syncing for loops (v2)
>
>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.
>
>v2: use while loop.

Ok, that makes it more obvious for me. 

Thanks.

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

M

>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 | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c
>b/drivers/gpu/drm/nouveau/nouveau_bo.c
>index 2375711877cf..fabb314a0b2f 100644
>--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
>+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
>@@ -556,7 +556,8 @@ nouveau_bo_sync_for_device(struct nouveau_bo
>*nvbo)
> 	if (nvbo->force_coherent)
> 		return;
>
>-	for (i = 0; i < ttm_dma->num_pages; ++i) {
>+	i = 0;
>+	while (i < ttm_dma->num_pages) {
> 		struct page *p = ttm_dma->pages[i];
> 		size_t num_pages = 1;
>
>@@ -587,7 +588,8 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo
>*nvbo)
> 	if (nvbo->force_coherent)
> 		return;
>
>-	for (i = 0; i < ttm_dma->num_pages; ++i) {
>+	i = 0;
>+	while (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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-11 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-11  4:35 [PATCH] drm/nouveau: fix dma syncing for loops (v2) Dave Airlie
2021-03-11 12:42 ` Ruhl, Michael J

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.