summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-04-15 01:42:22 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-04-15 01:42:22 +0000
commit70ffbffefa4f4d80676024d3fcbe8ffdd20a7d3d (patch)
tree04fcb5ae6d1d24ad9d53412b810457997721746f
parent1375013c65266f501c4b3c74bdcf66180b8844fc (diff)
drm/ttm: return ENOSPC from ttm_bo_mem_space v3
From Christian Koenig 852ad6a4f55c1e90123eff6d957119d4d5f27726 in linux-6.6.y/6.6.27 28e5126718c7b306b8c29d2ae8f48417e9303aa1 in mainline linux
-rw-r--r--sys/dev/pci/drm/ttm/ttm_bo.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/ttm/ttm_bo.c b/sys/dev/pci/drm/ttm/ttm_bo.c
index ad9b8cf8fe3..16f91c29d1f 100644
--- a/sys/dev/pci/drm/ttm/ttm_bo.c
+++ b/sys/dev/pci/drm/ttm/ttm_bo.c
@@ -764,7 +764,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
* This function may sleep while waiting for space to become available.
* Returns:
* -EBUSY: No space available (only if no_wait == 1).
- * -ENOMEM: Could not allocate memory for the buffer object, either due to
+ * -ENOSPC: Could not allocate space for the buffer object, either due to
* fragmentation or concurrent allocators.
* -ERESTARTSYS: An interruptible sleep was interrupted by a signal.
*/
@@ -824,7 +824,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;
@@ -910,6 +910,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;