[PATCH] drm/nouveau: Fix bug in buffer relocs for Nouveau

From: Tanmay Bhushan
Date: Thu Jan 19 2023 - 18:03:08 EST


dma_resv_wait_timeout returns greater than zero on success
as opposed to ttm_bo_wait_ctx. As a result of that relocs
will fail and give failure even when it was a success.

Signed-off-by: Tanmay Bhushan <007047221b@xxxxxxxxx>
---
drivers/gpu/drm/nouveau/nouveau_gem.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index f77e44958037..0e3690459144 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -706,9 +706,8 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
ret = dma_resv_wait_timeout(nvbo->bo.base.resv,
DMA_RESV_USAGE_BOOKKEEP,
false, 15 * HZ);
- if (ret == 0)
+ if (ret <= 0) {
ret = -EBUSY;
- if (ret) {
NV_PRINTK(err, cli, "reloc wait_idle failed: %ld\n",
ret);
break;
--
2.34.1