* 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.
  */
                        goto error;
        }
 
-       ret = -ENOMEM;
+       ret = -ENOSPC;
        if (!type_found) {
                pr_err(TTM_PFX "No compatible memory type found\n");
                ret = -EINVAL;
                return -EINVAL;
 
        ret = ttm_bo_move_buffer(bo, placement, ctx);
+       /* For backward compatibility with userspace */
+       if (ret == -ENOSPC)
+               return -ENOMEM;
        if (ret)
                return ret;