Am 16.03.22 um 07:34 schrieb Arunpravin Paneer Selvam:
handle a situation in the condition order-- == min_order,
when order = 0 and min_order = 0, leading to order = -1,
it now won't exit the loop. To avoid this problem,
added a order check in the same condition, (i.e)
when order is 0, we return -ENOSPC
v2: use full name in email program and in Signed-off tag
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@xxxxxxx>
Acked-by: Christian König <christian.koenig@xxxxxxx>
BTW while going over the code I've seen this here in the function:
...
if (!pages)
break;
} while (1);
Can that be changed to "} while (pages);" instead? Would probably be a
little bit cleaner.
Regards,
Christian.
---
drivers/gpu/drm/drm_buddy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
index 72f52f293249..5ab66aaf2bbd 100644
--- a/drivers/gpu/drm/drm_buddy.c
+++ b/drivers/gpu/drm/drm_buddy.c
@@ -685,7 +685,7 @@ int drm_buddy_alloc_blocks(struct drm_buddy *mm,
if (!IS_ERR(block))
break;
- if (order-- == min_order) {
+ if (!order || order-- == min_order) {
err = -ENOSPC;
goto err_free;
}
base-commit: 3bd60c0259406c5ca3ce5cdc958fb910ad4b8175