summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2007-09-11 14:02:11 +0200
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-09-12 09:28:06 -0700
commit2966c6a03efd90197582eae8590d82c789475680 (patch)
tree714ed95bbf4c60f682a2693a5eb3a9a24bcd029a /arch
parent95b08679963c78ce0d675224a6efdb5169f2bf75 (diff)
x86_64: Prevent doing anything from cache_remove_dev() when info setup failed.
AK: Removed the unlikelies because gcc heuristics default to unlikely AK: for test == NULL and for negative returns. Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Cc: Ashok Raj <ashok.raj@intel.com> Cc: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/cpu/intel_cacheinfo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c
index d5a456d27d82..db6c25aa5776 100644
--- a/arch/i386/kernel/cpu/intel_cacheinfo.c
+++ b/arch/i386/kernel/cpu/intel_cacheinfo.c
@@ -515,7 +515,7 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
cpuid4_info[cpu] = kzalloc(
sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
- if (unlikely(cpuid4_info[cpu] == NULL))
+ if (cpuid4_info[cpu] == NULL)
return -ENOMEM;
oldmask = current->cpus_allowed;
@@ -748,6 +748,8 @@ static void __cpuinit cache_remove_dev(struct sys_device * sys_dev)
unsigned int cpu = sys_dev->id;
unsigned long i;
+ if (cpuid4_info[cpu] == NULL)
+ return;
for (i = 0; i < num_cache_leaves; i++) {
cache_remove_shared_cpu_map(cpu, i);
kobject_unregister(&(INDEX_KOBJECT_PTR(cpu,i)->kobj));