Patch from John Levon <levon@movementarian.org>

wli got an oops from this. The callbacks call mod_timer so the timer had
better be setup by then




 drivers/oprofile/buffer_sync.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff -puN drivers/oprofile/buffer_sync.c~oprofile-timer-fix drivers/oprofile/buffer_sync.c
--- 25/drivers/oprofile/buffer_sync.c~oprofile-timer-fix	2003-03-17 21:33:18.000000000 -0800
+++ 25-akpm/drivers/oprofile/buffer_sync.c	2003-03-17 21:33:18.000000000 -0800
@@ -82,9 +82,16 @@ static struct notifier_block exit_mmap_n
  
 int sync_start(void)
 {
-	int err = profile_event_register(EXIT_TASK, &exit_task_nb);
+	int err;
+
+	init_timer(&sync_timer);
+	sync_timer.function = timer_ping;
+	sync_timer.expires = jiffies + DEFAULT_EXPIRE;
+	add_timer(&sync_timer);
+
+	err = profile_event_register(EXIT_TASK, &exit_task_nb);
 	if (err)
-		goto out;
+		goto out1;
 	err = profile_event_register(EXIT_MMAP, &exit_mmap_nb);
 	if (err)
 		goto out2;
@@ -92,16 +99,14 @@ int sync_start(void)
 	if (err)
 		goto out3;
 
-	init_timer(&sync_timer);
-	sync_timer.function = timer_ping;
-	sync_timer.expires = jiffies + DEFAULT_EXPIRE;
-	add_timer(&sync_timer);
 out:
 	return err;
 out3:
 	profile_event_unregister(EXIT_MMAP, &exit_mmap_nb);
 out2:
 	profile_event_unregister(EXIT_TASK, &exit_task_nb);
+out1:
+	del_timer_sync(&sync_timer);
 	goto out;
 }
 

_