[tip:core/debugobjects] timer: Setup uninitialized timer with a stub callback

From: tip-bot for Stephen Boyd
Date: Mon Nov 28 2011 - 09:20:42 EST


Commit-ID: fb16b8cf0b66386134b09e7b8b7056450272d159
Gitweb: http://git.kernel.org/tip/fb16b8cf0b66386134b09e7b8b7056450272d159
Author: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>
AuthorDate: Mon, 7 Nov 2011 19:48:26 -0800
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitDate: Wed, 23 Nov 2011 18:49:23 +0100

timer: Setup uninitialized timer with a stub callback

Remove the WARN_ON() in timer_fixup_activate() as we now get the
debugobjects printout in the debugobjects activate check.

We also assign a dummy timer callback so that if the timer is
actually set to fire we don't oops.

[ tglx@xxxxxxxxxxxxx: Split out the debugobjects vs. the timer change ]

Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>
Cc: Christine Chan <cschan@xxxxxxxxxxxxxx>
Cc: John Stultz <john.stultz@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Link: http://lkml.kernel.org/r/1320724108-20788-2-git-send-email-sboyd@xxxxxxxxxxxxxx
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
kernel/timer.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/kernel/timer.c b/kernel/timer.c
index dbaa624..317087d 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -427,6 +427,12 @@ static int timer_fixup_init(void *addr, enum debug_obj_state state)
}
}

+/* Stub timer callback for improperly used timers. */
+static void stub_timer(unsigned long data)
+{
+ WARN_ON(1);
+}
+
/*
* fixup_activate is called when:
* - an active object is activated
@@ -450,7 +456,8 @@ static int timer_fixup_activate(void *addr, enum debug_obj_state state)
debug_object_activate(timer, &timer_debug_descr);
return 0;
} else {
- WARN_ON_ONCE(1);
+ setup_timer(timer, stub_timer, 0);
+ return 1;
}
return 0;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/