]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/msr.c
x86: msr: propagate errors from smp_call_function_single()
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / msr.c
index a153b3905f60591cb6fb627cad9dcc6e529e25cb..9c34a1005dba986fbaea969b81aa88676f07741b 100644 (file)
@@ -79,8 +79,11 @@ static ssize_t msr_read(struct file *file, char __user *buf,
 
        for (; count; count -= 8) {
                err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]);
-               if (err)
-                       return -EIO;
+               if (err) {
+                       if (err == -EFAULT) /* Fix idiotic error code */
+                               err = -EIO;
+                       return err;
+               }
                if (copy_to_user(tmp, &data, 8))
                        return -EFAULT;
                tmp += 2;
@@ -105,8 +108,11 @@ static ssize_t msr_write(struct file *file, const char __user *buf,
                if (copy_from_user(&data, tmp, 8))
                        return -EFAULT;
                err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]);
-               if (err)
-                       return -EIO;
+               if (err) {
+                       if (err == -EFAULT) /* Fix idiotic error code */
+                               err = -EIO;
+                       return err;
+               }
                tmp += 2;
        }
 
@@ -131,7 +137,7 @@ static int msr_open(struct inode *inode, struct file *file)
                ret = -EIO;     /* MSR not supported */
 out:
        unlock_kernel();
-       return 0;
+       return ret;
 }
 
 /*
@@ -149,8 +155,8 @@ static int __cpuinit msr_device_create(int cpu)
 {
        struct device *dev;
 
-       dev = device_create(msr_class, NULL, MKDEV(MSR_MAJOR, cpu),
-                           "msr%d", cpu);
+       dev = device_create_drvdata(msr_class, NULL, MKDEV(MSR_MAJOR, cpu),
+                                   NULL, "msr%d", cpu);
        return IS_ERR(dev) ? PTR_ERR(dev) : 0;
 }