Skip to content

Commit

Permalink
debugobjects: Be smarter about static objects
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bebarino authored and KAGA-KOKO committed Nov 23, 2011
1 parent c5e0c78 commit feac18d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/debugobjects.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,16 @@ static void debug_print_object(struct debug_obj *obj, char *msg)
* Try to repair the damage, so we have a better chance to get useful
* debug output.
*/
static void
static int
debug_object_fixup(int (*fixup)(void *addr, enum debug_obj_state state),
void * addr, enum debug_obj_state state)
{
int fixed = 0;

if (fixup)
debug_objects_fixups += fixup(addr, state);
fixed = fixup(addr, state);
debug_objects_fixups += fixed;
return fixed;
}

static void debug_object_is_on_stack(void *addr, int onstack)
Expand Down Expand Up @@ -386,6 +390,9 @@ void debug_object_activate(void *addr, struct debug_obj_descr *descr)
struct debug_bucket *db;
struct debug_obj *obj;
unsigned long flags;
struct debug_obj o = { .object = addr,
.state = ODEBUG_STATE_NOTAVAILABLE,
.descr = descr };

if (!debug_objects_enabled)
return;
Expand Down Expand Up @@ -425,8 +432,9 @@ void debug_object_activate(void *addr, struct debug_obj_descr *descr)
* let the type specific code decide whether this is
* true or not.
*/
debug_object_fixup(descr->fixup_activate, addr,
ODEBUG_STATE_NOTAVAILABLE);
if (debug_object_fixup(descr->fixup_activate, addr,
ODEBUG_STATE_NOTAVAILABLE))
debug_print_object(&o, "activate");
}

/**
Expand Down

0 comments on commit feac18d

Please sign in to comment.