Skip to content

Commit feac18d

Browse files
bebarinoKAGA-KOKO
authored andcommitted
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>
1 parent c5e0c78 commit feac18d

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

‎lib/debugobjects.c‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,16 @@ static void debug_print_object(struct debug_obj *obj, char *msg)
268268
* Try to repair the damage, so we have a better chance to get useful
269269
* debug output.
270270
*/
271-
static void
271+
static int
272272
debug_object_fixup(int (*fixup)(void *addr, enum debug_obj_state state),
273273
void * addr, enum debug_obj_state state)
274274
{
275+
int fixed = 0;
276+
275277
if (fixup)
276-
debug_objects_fixups += fixup(addr, state);
278+
fixed = fixup(addr, state);
279+
debug_objects_fixups += fixed;
280+
return fixed;
277281
}
278282

279283
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)
386390
struct debug_bucket *db;
387391
struct debug_obj *obj;
388392
unsigned long flags;
393+
struct debug_obj o = { .object = addr,
394+
.state = ODEBUG_STATE_NOTAVAILABLE,
395+
.descr = descr };
389396

390397
if (!debug_objects_enabled)
391398
return;
@@ -425,8 +432,9 @@ void debug_object_activate(void *addr, struct debug_obj_descr *descr)
425432
* let the type specific code decide whether this is
426433
* true or not.
427434
*/
428-
debug_object_fixup(descr->fixup_activate, addr,
429-
ODEBUG_STATE_NOTAVAILABLE);
435+
if (debug_object_fixup(descr->fixup_activate, addr,
436+
ODEBUG_STATE_NOTAVAILABLE))
437+
debug_print_object(&o, "activate");
430438
}
431439

432440
/**

0 commit comments

Comments
 (0)