projects
/
platform
/
adaptation
/
renesas_rcar
/
renesas_kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
x86/mce: Fix return value of mce_chrdev_read() when erst is disabled
[platform/adaptation/renesas_rcar/renesas_kernel.git]
/
arch
/
x86
/
kernel
/
cpu
/
mcheck
/
mce.c
diff --git
a/arch/x86/kernel/cpu/mcheck/mce.c
b/arch/x86/kernel/cpu/mcheck/mce.c
index
29ba329
..
87c56ba
100644
(file)
--- a/
arch/x86/kernel/cpu/mcheck/mce.c
+++ b/
arch/x86/kernel/cpu/mcheck/mce.c
@@
-1541,6
+1541,12
@@
static int __mce_read_apei(char __user **ubuf, size_t usize)
/* Error or no more MCE record */
if (rc <= 0) {
mce_apei_read_done = 1;
/* Error or no more MCE record */
if (rc <= 0) {
mce_apei_read_done = 1;
+ /*
+ * When ERST is disabled, mce_chrdev_read() should return
+ * "no record" instead of "no device."
+ */
+ if (rc == -ENODEV)
+ return 0;
return rc;
}
rc = -EFAULT;
return rc;
}
rc = -EFAULT;
@@
-1859,7
+1865,7
@@
static struct bus_type mce_subsys = {
.dev_name = "machinecheck",
};
.dev_name = "machinecheck",
};
-DEFINE_PER_CPU(struct device, mce_device);
+DEFINE_PER_CPU(struct device
*
, mce_device);
__cpuinitdata
void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
__cpuinitdata
void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
@@
-2001,19
+2007,27
@@
static struct device_attribute *mce_device_attrs[] = {
static cpumask_var_t mce_device_initialized;
static cpumask_var_t mce_device_initialized;
+static void mce_device_release(struct device *dev)
+{
+ kfree(dev);
+}
+
/* Per cpu device init. All of the cpus still share the same ctrl bank: */
static __cpuinit int mce_device_create(unsigned int cpu)
{
/* Per cpu device init. All of the cpus still share the same ctrl bank: */
static __cpuinit int mce_device_create(unsigned int cpu)
{
- struct device *dev
= &per_cpu(mce_device, cpu)
;
+ struct device *dev;
int err;
int i, j;
if (!mce_available(&boot_cpu_data))
return -EIO;
int err;
int i, j;
if (!mce_available(&boot_cpu_data))
return -EIO;
- memset(dev, 0, sizeof(struct device));
+ dev = kzalloc(sizeof *dev, GFP_KERNEL);
+ if (!dev)
+ return -ENOMEM;
dev->id = cpu;
dev->bus = &mce_subsys;
dev->id = cpu;
dev->bus = &mce_subsys;
+ dev->release = &mce_device_release;
err = device_register(dev);
if (err)
err = device_register(dev);
if (err)
@@
-2030,6
+2044,7
@@
static __cpuinit int mce_device_create(unsigned int cpu)
goto error2;
}
cpumask_set_cpu(cpu, mce_device_initialized);
goto error2;
}
cpumask_set_cpu(cpu, mce_device_initialized);
+ per_cpu(mce_device, cpu) = dev;
return 0;
error2:
return 0;
error2:
@@
-2046,7
+2061,7
@@
error:
static __cpuinit void mce_device_remove(unsigned int cpu)
{
static __cpuinit void mce_device_remove(unsigned int cpu)
{
- struct device *dev =
&
per_cpu(mce_device, cpu);
+ struct device *dev = per_cpu(mce_device, cpu);
int i;
if (!cpumask_test_cpu(cpu, mce_device_initialized))
int i;
if (!cpumask_test_cpu(cpu, mce_device_initialized))
@@
-2060,6
+2075,7
@@
static __cpuinit void mce_device_remove(unsigned int cpu)
device_unregister(dev);
cpumask_clear_cpu(cpu, mce_device_initialized);
device_unregister(dev);
cpumask_clear_cpu(cpu, mce_device_initialized);
+ per_cpu(mce_device, cpu) = NULL;
}
/* Make sure there are no machine checks on offlined CPUs. */
}
/* Make sure there are no machine checks on offlined CPUs. */