linux-mips
[Top] [All Lists]

[PATCH] fix oprofile module unloading

To: linux-mips@linux-mips.org
Subject: [PATCH] fix oprofile module unloading
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Fri, 21 Apr 2006 23:35:11 +0900 (JST)
Cc: ralf@linux-mips.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
When unloading oprofile module with timer-mode, oprofile_arch_exit
dereferences a NULL pointer.  This patch fixes it and also fix a
sparse warning.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index 935dd85..f2b4862 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -27,7 +27,7 @@ static int op_mips_setup(void)
        model->reg_setup(ctr);
 
        /* Configure the registers on all cpus.  */
-       on_each_cpu(model->cpu_setup, 0, 0, 1);
+       on_each_cpu(model->cpu_setup, NULL, 0, 1);
 
         return 0;
 }
@@ -114,5 +114,6 @@ int __init oprofile_arch_init(struct opr
 
 void oprofile_arch_exit(void)
 {
-       model->exit();
+       if (model)
+               model->exit();
 }

<Prev in Thread] Current Thread [Next in Thread>