mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
debugobjects: Extend to assert that an object is initialized
Calling del_timer_sync() on an uninitialized timer leads to a never ending loop in lock_timer_base() that spins checking for a non-NULL timer base. Add an assertion to debugobjects to catch usage of uninitialized objects so that we can initialize timers in the del_timer_sync() path before it calls lock_timer_base(). [ sboyd@codeaurora.org: Clarify commit message ] Signed-off-by: Christine Chan <cschan@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Cc: John Stultz <john.stultz@linaro.org> Link: http://lkml.kernel.org/r/1320724108-20788-3-git-send-email-sboyd@codeaurora.org Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
feac18dda2
commit
b84d435cc2
3 changed files with 94 additions and 0 deletions
|
@ -46,6 +46,8 @@ struct debug_obj {
|
|||
* fails
|
||||
* @fixup_free: fixup function, which is called when the free check
|
||||
* fails
|
||||
* @fixup_assert_init: fixup function, which is called when the assert_init
|
||||
* check fails
|
||||
*/
|
||||
struct debug_obj_descr {
|
||||
const char *name;
|
||||
|
@ -54,6 +56,7 @@ struct debug_obj_descr {
|
|||
int (*fixup_activate) (void *addr, enum debug_obj_state state);
|
||||
int (*fixup_destroy) (void *addr, enum debug_obj_state state);
|
||||
int (*fixup_free) (void *addr, enum debug_obj_state state);
|
||||
int (*fixup_assert_init)(void *addr, enum debug_obj_state state);
|
||||
};
|
||||
|
||||
#ifdef CONFIG_DEBUG_OBJECTS
|
||||
|
@ -64,6 +67,7 @@ extern void debug_object_activate (void *addr, struct debug_obj_descr *descr);
|
|||
extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
|
||||
extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
|
||||
extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
|
||||
extern void debug_object_assert_init(void *addr, struct debug_obj_descr *descr);
|
||||
|
||||
/*
|
||||
* Active state:
|
||||
|
@ -89,6 +93,8 @@ static inline void
|
|||
debug_object_destroy (void *addr, struct debug_obj_descr *descr) { }
|
||||
static inline void
|
||||
debug_object_free (void *addr, struct debug_obj_descr *descr) { }
|
||||
static inline void
|
||||
debug_object_assert_init(void *addr, struct debug_obj_descr *descr) { }
|
||||
|
||||
static inline void debug_objects_early_init(void) { }
|
||||
static inline void debug_objects_mem_init(void) { }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue