[PATCH 2/2] debugobjects: Use free_object_list() in the boot error path

From: Sang-Heon Jeon

Date: Sun Nov 08 2026 - 23:13:24 EST


Now that free_object_list() takes a cache argument, use it in the error
path of debug_objects_replace_static_objects() instead of open coding
the loop.

Signed-off-by: Sang-Heon Jeon <ekffu200098@xxxxxxxxx>
---
lib/debugobjects.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 7ab1fd8e0891..b066036ff37e 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -1502,7 +1502,6 @@ void __init debug_objects_early_init(void)
static bool __init debug_objects_replace_static_objects(struct kmem_cache *cache)
{
struct debug_bucket *db = obj_hash;
- struct hlist_node *tmp;
struct debug_obj *obj;
HLIST_HEAD(objects);
int i;
@@ -1530,11 +1529,7 @@ static bool __init debug_objects_replace_static_objects(struct kmem_cache *cache
}
return true;
free:
- /* Can't use free_object_list() as the cache is not populated yet */
- hlist_for_each_entry_safe(obj, tmp, &pool_global.objects, node) {
- hlist_del(&obj->node);
- kmem_cache_free(cache, obj);
- }
+ free_object_list(&pool_global.objects, cache);
return false;
}

--
2.53.0