From: Venki Pallipadi Date: Mon, 26 Mar 2007 19:03:19 +0000 (-0700) Subject: [PATCH] Fix maxcpus=1 trigerring BUG() in cpufreq X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ec28297a562f2b022115b9eb82e4ea724d996240;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git [PATCH] Fix maxcpus=1 trigerring BUG() in cpufreq Ingo reported it on lkml in the thread "2.6.21-rc5: maxcpus=1 crash in cpufreq: kernel BUG at drivers/cpufreq/cpufreq.c:82!" This check added to remove_dev is symmetric to one in add_dev and handles callbacks for offline cpus cleanly. Signed-off-by: Venkatesh Pallipadi Acked-by: Ingo Molnar Signed-off-by: Linus Torvalds --- diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index f52facc570f5..3162010900c9 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1015,6 +1015,10 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) { unsigned int cpu = sys_dev->id; int retval; + + if (cpu_is_offline(cpu)) + return 0; + if (unlikely(lock_policy_rwsem_write(cpu))) BUG();