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@xxxxxxxxxxxxx> 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(); }