Skip to contentSkip to conversation

drm/ttm: return ENOSPC from ttm_bo_mem_space

PATCH New Christian König 1 participant 1 message Jan 4, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 drm/ttm: return ENOSPC from ttm_bo_mem_space

Only convert it to ENOMEM in ttm_bo_validate.

---
 drivers/gpu/drm/ttm/ttm_bo.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +4 -1
index edf10618fe2b..8c1eaa74fa21 100644
@@ -830,7 +830,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
 			goto error;
 	}
 
-	ret = -ENOMEM;
+	ret = -ENOSPC;
 	if (!type_found) {
 		pr_err(TTM_PFX "No compatible memory type found\n");
 		ret = -EINVAL;
@@ -916,6 +916,9 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
 		return -EINVAL;
 
 	ret = ttm_bo_move_buffer(bo, placement, ctx);
+	/* For backward compatibility with userspace */
+	if (ret == -ENOSPC)
+		return -ENOMEM;
 	if (ret)
 		return ret;
 
Signature · 1 line
2.34.1