[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 <venkatesh.pallipadi@intel.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Venki Pallipadi 2007-03-26 12:03:19 -07:00 committed by Linus Torvalds
parent 703071b5b9
commit ec28297a56
1 changed files with 4 additions and 0 deletions

View File

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