Skip to content

Commit

Permalink
x86, mce: trivial clean up for mce-inject.c
Browse files Browse the repository at this point in the history
Fix for:

WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
+#include <asm/uaccess.h>

WARNING: usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc
+       if (m.cpu >= NR_CPUS || !cpu_online(m.cpu))

ERROR: trailing whitespace
+/* $

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
  • Loading branch information
Hidetoshi Seto authored and H. Peter Anvin committed May 28, 2009
1 parent 61a021a commit 98a9c8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kernel/cpu/mcheck/mce-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
* Andi Kleen
* Ying Huang
*/
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/timer.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/smp.h>
#include <asm/uaccess.h>
#include <asm/mce.h>

/* Update fake mce registers on current CPU. */
Expand Down Expand Up @@ -93,7 +93,7 @@ static ssize_t mce_write(struct file *filp, const char __user *ubuf,
if (copy_from_user(&m, ubuf, usize))
return -EFAULT;

if (m.cpu >= NR_CPUS || !cpu_online(m.cpu))
if (m.cpu >= num_possible_cpus() || !cpu_online(m.cpu))
return -EINVAL;

dm = kmalloc(sizeof(struct delayed_mce), GFP_KERNEL);
Expand Down

0 comments on commit 98a9c8c

Please sign in to comment.