From: Pekka Enberg This patch has the following cleanups to oprofile: - Remove spurious casts - vfree() accepts NULL pointers so remove redundant test - The parameter for __free_cpu_buffer() is not used so merge the function with free_cpu_buffer() Signed-off-by: Pekka Enberg Signed-off-by: Andrew Morton --- 25-akpm/drivers/oprofile/buffer_sync.c | 2 +- 25-akpm/drivers/oprofile/cpu_buffer.c | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff -puN drivers/oprofile/buffer_sync.c~oprofile-minor-cleanups drivers/oprofile/buffer_sync.c --- 25/drivers/oprofile/buffer_sync.c~oprofile-minor-cleanups 2004-11-28 01:58:21.618825000 -0800 +++ 25-akpm/drivers/oprofile/buffer_sync.c 2004-11-28 01:58:21.623824240 -0800 @@ -46,7 +46,7 @@ void process_task_mortuary(void); */ static int task_free_notify(struct notifier_block * self, unsigned long val, void * data) { - struct task_struct * task = (struct task_struct *)data; + struct task_struct * task = data; spin_lock(&task_mortuary); list_add(&task->tasks, &dying_tasks); spin_unlock(&task_mortuary); diff -puN drivers/oprofile/cpu_buffer.c~oprofile-minor-cleanups drivers/oprofile/cpu_buffer.c --- 25/drivers/oprofile/cpu_buffer.c~oprofile-minor-cleanups 2004-11-28 01:58:21.619824848 -0800 +++ 25-akpm/drivers/oprofile/cpu_buffer.c 2004-11-28 01:58:21.624824088 -0800 @@ -34,13 +34,12 @@ static void wq_sync_buffer(void *); #define DEFAULT_TIMER_EXPIRE (HZ / 10) int work_enabled; -static void __free_cpu_buffers(int num) +void free_cpu_buffers(void) { int i; for_each_online_cpu(i) { - if (cpu_buffer[i].buffer) - vfree(cpu_buffer[i].buffer); + vfree(cpu_buffer[i].buffer); } } @@ -72,17 +71,11 @@ int alloc_cpu_buffers(void) return 0; fail: - __free_cpu_buffers(i); + free_cpu_buffers(); return -ENOMEM; } -void free_cpu_buffers(void) -{ - __free_cpu_buffers(NR_CPUS); -} - - void start_cpu_work(void) { int i; @@ -301,7 +294,7 @@ void oprofile_add_trace(unsigned long pc */ static void wq_sync_buffer(void * data) { - struct oprofile_cpu_buffer * b = (struct oprofile_cpu_buffer *)data; + struct oprofile_cpu_buffer * b = data; if (b->cpu != smp_processor_id()) { printk("WQ on CPU%d, prefer CPU%d\n", smp_processor_id(), b->cpu); _