diff options
author | Christine Chan <cschan@codeaurora.org> | 2011-11-07 22:48:27 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-11-23 12:49:22 -0500 |
commit | b84d435cc228e87951f3bbabf6cc4a5f25d5fb16 (patch) | |
tree | 4a43e7224c49f1ef9b3f25d38a80c29c2692b8dc /include/linux/debugobjects.h | |
parent | feac18dda25134005909e7770c77464e65608bd8 (diff) |
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>
Diffstat (limited to 'include/linux/debugobjects.h')
-rw-r--r-- | include/linux/debugobjects.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h index 65970b811e22..0e5f5785d9f2 100644 --- a/include/linux/debugobjects.h +++ b/include/linux/debugobjects.h | |||
@@ -46,6 +46,8 @@ struct debug_obj { | |||
46 | * fails | 46 | * fails |
47 | * @fixup_free: fixup function, which is called when the free check | 47 | * @fixup_free: fixup function, which is called when the free check |
48 | * fails | 48 | * fails |
49 | * @fixup_assert_init: fixup function, which is called when the assert_init | ||
50 | * check fails | ||
49 | */ | 51 | */ |
50 | struct debug_obj_descr { | 52 | struct debug_obj_descr { |
51 | const char *name; | 53 | const char *name; |
@@ -54,6 +56,7 @@ struct debug_obj_descr { | |||
54 | int (*fixup_activate) (void *addr, enum debug_obj_state state); | 56 | int (*fixup_activate) (void *addr, enum debug_obj_state state); |
55 | int (*fixup_destroy) (void *addr, enum debug_obj_state state); | 57 | int (*fixup_destroy) (void *addr, enum debug_obj_state state); |
56 | int (*fixup_free) (void *addr, enum debug_obj_state state); | 58 | int (*fixup_free) (void *addr, enum debug_obj_state state); |
59 | int (*fixup_assert_init)(void *addr, enum debug_obj_state state); | ||
57 | }; | 60 | }; |
58 | 61 | ||
59 | #ifdef CONFIG_DEBUG_OBJECTS | 62 | #ifdef CONFIG_DEBUG_OBJECTS |
@@ -64,6 +67,7 @@ extern void debug_object_activate (void *addr, struct debug_obj_descr *descr); | |||
64 | extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr); | 67 | extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr); |
65 | extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); | 68 | extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); |
66 | extern void debug_object_free (void *addr, struct debug_obj_descr *descr); | 69 | extern void debug_object_free (void *addr, struct debug_obj_descr *descr); |
70 | extern void debug_object_assert_init(void *addr, struct debug_obj_descr *descr); | ||
67 | 71 | ||
68 | /* | 72 | /* |
69 | * Active state: | 73 | * Active state: |
@@ -89,6 +93,8 @@ static inline void | |||
89 | debug_object_destroy (void *addr, struct debug_obj_descr *descr) { } | 93 | debug_object_destroy (void *addr, struct debug_obj_descr *descr) { } |
90 | static inline void | 94 | static inline void |
91 | debug_object_free (void *addr, struct debug_obj_descr *descr) { } | 95 | debug_object_free (void *addr, struct debug_obj_descr *descr) { } |
96 | static inline void | ||
97 | debug_object_assert_init(void *addr, struct debug_obj_descr *descr) { } | ||
92 | 98 | ||
93 | static inline void debug_objects_early_init(void) { } | 99 | static inline void debug_objects_early_init(void) { } |
94 | static inline void debug_objects_mem_init(void) { } | 100 | static inline void debug_objects_mem_init(void) { } |