Re: [PATCH v2] debug: Fix a mixed use of NULL and error pointers
From: Kuan-Wei Chiu
Date: Thu Nov 13 2025 - 15:03:41 EST
Hi Haotian,
On Tue, Nov 11, 2025 at 10:15:21AM +0800, Haotian Zhang wrote:
> The lookup_object_or_alloc() function currently returns either error
> pointers (ERR_PTR(-ENOENT)) or NULL on allocation failure. Mixing error
> pointers and NULL is confusing and makes the code harder to maintain.
> Change lookup_object_or_alloc() to consistently return error pointers
> for all error cases by returning ERR_PTR(-ENOMEM) instead of NULL when
> allocation fails.
>
> Update all three call sites (__debug_object_init, debug_object_activate,
> and debug_object_assert_init) to use IS_ERR() for error checking and
> handle -ENOMEM by calling debug_objects_oom().
>
> Fixes: 63a759694eed ("debugobject: Prevent init race with static objects")
> Suggested-by: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
> Signed-off-by: Haotian Zhang <vulab@xxxxxxxxxxx>
Nit: The majority of the past git commit history uses debugobjects: as
the subject line prefix rather than debug:
Regards,
Kuan-Wei