diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2011-11-07 22:48:26 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-11-23 12:49:22 -0500 |
commit | feac18dda25134005909e7770c77464e65608bd8 (patch) | |
tree | 2c3b2d2dfe0ca8ed9f12e49da9f86ad7845bf002 /lib/debugobjects.c | |
parent | c5e0c7825d3a14c2dfc383763393f0bcb5400aa6 (diff) |
debugobjects: Be smarter about static objects
Make debugobjects use the return code from the fixup function. That
allows us better diagnostics in the activate check than relying on a
WARN_ON() in the object specific code.
[ tglx@linutronix.de: Split out the debugobjects vs. the timer change ]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Christine Chan <cschan@codeaurora.org>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/1320724108-20788-2-git-send-email-sboyd@codeaurora.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'lib/debugobjects.c')
-rw-r--r-- | lib/debugobjects.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/debugobjects.c b/lib/debugobjects.c index a78b7c6e042c..b7a530504b38 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c | |||
@@ -268,12 +268,16 @@ static void debug_print_object(struct debug_obj *obj, char *msg) | |||
268 | * Try to repair the damage, so we have a better chance to get useful | 268 | * Try to repair the damage, so we have a better chance to get useful |
269 | * debug output. | 269 | * debug output. |
270 | */ | 270 | */ |
271 | static void | 271 | static int |
272 | debug_object_fixup(int (*fixup)(void *addr, enum debug_obj_state state), | 272 | debug_object_fixup(int (*fixup)(void *addr, enum debug_obj_state state), |
273 | void * addr, enum debug_obj_state state) | 273 | void * addr, enum debug_obj_state state) |
274 | { | 274 | { |
275 | int fixed = 0; | ||
276 | |||
275 | if (fixup) | 277 | if (fixup) |
276 | debug_objects_fixups += fixup(addr, state); | 278 | fixed = fixup(addr, state); |
279 | debug_objects_fixups += fixed; | ||
280 | return fixed; | ||
277 | } | 281 | } |
278 | 282 | ||
279 | static void debug_object_is_on_stack(void *addr, int onstack) | 283 | static void debug_object_is_on_stack(void *addr, int onstack) |
@@ -386,6 +390,9 @@ void debug_object_activate(void *addr, struct debug_obj_descr *descr) | |||
386 | struct debug_bucket *db; | 390 | struct debug_bucket *db; |
387 | struct debug_obj *obj; | 391 | struct debug_obj *obj; |
388 | unsigned long flags; | 392 | unsigned long flags; |
393 | struct debug_obj o = { .object = addr, | ||
394 | .state = ODEBUG_STATE_NOTAVAILABLE, | ||
395 | .descr = descr }; | ||
389 | 396 | ||
390 | if (!debug_objects_enabled) | 397 | if (!debug_objects_enabled) |
391 | return; | 398 | return; |
@@ -425,8 +432,9 @@ void debug_object_activate(void *addr, struct debug_obj_descr *descr) | |||
425 | * let the type specific code decide whether this is | 432 | * let the type specific code decide whether this is |
426 | * true or not. | 433 | * true or not. |
427 | */ | 434 | */ |
428 | debug_object_fixup(descr->fixup_activate, addr, | 435 | if (debug_object_fixup(descr->fixup_activate, addr, |
429 | ODEBUG_STATE_NOTAVAILABLE); | 436 | ODEBUG_STATE_NOTAVAILABLE)) |
437 | debug_print_object(&o, "activate"); | ||
430 | } | 438 | } |
431 | 439 | ||
432 | /** | 440 | /** |