diff mbox series

[1/1] drm: add error message for ENOSPC

Message ID 20210527094535.31728-2-krishnaiah.bommu@intel.com (mailing list archive)
State New, archived
Headers show
Series drm: add error message for ENOSPC | expand

Commit Message

Bommu, Krishnaiah May 27, 2021, 9:45 a.m. UTC
add error message for ENOSPC, this will help developer to understand issue.

Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
Cc: Yang Shi <yang.a.shi@intel.com>
Cc: Nayana Venkata Ramana <Venkata.Ramana.Nayana@intel.com>
---
 drivers/gpu/drm/drm_mm.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index a4a04d246135..696b59673a84 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -458,13 +458,18 @@  int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node)
 	u64 end;
 
 	end = node->start + node->size;
-	if (unlikely(end <= node->start))
+	if (unlikely(end <= node->start)) {
+		DRM_DEBUG("ENOSPC with incorrect node->size %llx\n", node->size);
 		return -ENOSPC;
+	}
 
 	/* Find the relevant hole to add our node to */
 	hole = find_hole_addr(mm, node->start, 0);
-	if (!hole)
+	if (!hole) {
+		DRM_DEBUG("ENOSPC when not find hole with node->start %llx\n",
+			  node->start);
 		return -ENOSPC;
+	}
 
 	adj_start = hole_start = __drm_mm_hole_node_start(hole);
 	adj_end = hole_end = hole_start + hole->hole_size;
@@ -472,8 +477,11 @@  int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node)
 	if (mm->color_adjust)
 		mm->color_adjust(hole, node->color, &adj_start, &adj_end);
 
-	if (adj_start > node->start || adj_end < end)
+	if (adj_start > node->start || adj_end < end) {
+		DRM_DEBUG("ENOSPC after adjust adj_start:%llx adj_end:%llx node->start:%llx end:%llx\n",
+			  adj_start, adj_end, node->start, end);
 		return -ENOSPC;
+	}
 
 	node->mm = mm;