Commit 9f78ff00 authored by Stephen Boyd's avatar Stephen Boyd Committed by Linus Torvalds

debugobjects: Fix selftest for static warnings

debugobjects is now printing a warning when a fixup for a NOTAVAILABLE
object is run.  This causes the selftest to fail like:

	ODEBUG: selftest warnings failed 4 != 5

We could just increase the number of warnings that the selftest is
expecting to see because that is actually what has changed.  But, it turns
out that fixup_activate() was written with inverted logic and thus a fixup
for a static object returned 1 indicating the object had been fixed, and 0
otherwise.  Fix the logic to be correct and update the counts to reflect
that nothing needed fixing for a static object.
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Reported-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9354f1b8
...@@ -818,17 +818,9 @@ static int __init fixup_activate(void *addr, enum debug_obj_state state) ...@@ -818,17 +818,9 @@ static int __init fixup_activate(void *addr, enum debug_obj_state state)
if (obj->static_init == 1) { if (obj->static_init == 1) {
debug_object_init(obj, &descr_type_test); debug_object_init(obj, &descr_type_test);
debug_object_activate(obj, &descr_type_test); debug_object_activate(obj, &descr_type_test);
/* return 0;
* Real code should return 0 here ! This is
* not a fixup of some bad behaviour. We
* merily call the debug_init function to keep
* track of the object.
*/
return 1;
} else {
/* Real code needs to emit a warning here */
} }
return 0; return 1;
case ODEBUG_STATE_ACTIVE: case ODEBUG_STATE_ACTIVE:
debug_object_deactivate(obj, &descr_type_test); debug_object_deactivate(obj, &descr_type_test);
...@@ -967,7 +959,7 @@ static void __init debug_objects_selftest(void) ...@@ -967,7 +959,7 @@ static void __init debug_objects_selftest(void)
obj.static_init = 1; obj.static_init = 1;
debug_object_activate(&obj, &descr_type_test); debug_object_activate(&obj, &descr_type_test);
if (check_results(&obj, ODEBUG_STATE_ACTIVE, ++fixups, warnings)) if (check_results(&obj, ODEBUG_STATE_ACTIVE, fixups, warnings))
goto out; goto out;
debug_object_init(&obj, &descr_type_test); debug_object_init(&obj, &descr_type_test);
if (check_results(&obj, ODEBUG_STATE_INIT, ++fixups, ++warnings)) if (check_results(&obj, ODEBUG_STATE_INIT, ++fixups, ++warnings))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment