Commit b1f49f95 authored by Hidetoshi Seto's avatar Hidetoshi Seto Committed by H. Peter Anvin

x86, mce: fix error path in mce_create_device()

Don't skip removing mce_attrs in route from error2.
Signed-off-by: default avatarHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Huang Ying <ying.huang@intel.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent e92fae06
...@@ -1798,7 +1798,7 @@ static cpumask_var_t mce_dev_initialized; ...@@ -1798,7 +1798,7 @@ static cpumask_var_t mce_dev_initialized;
static __cpuinit int mce_create_device(unsigned int cpu) static __cpuinit int mce_create_device(unsigned int cpu)
{ {
int err; int err;
int i; int i, j;
if (!mce_available(&boot_cpu_data)) if (!mce_available(&boot_cpu_data))
return -EIO; return -EIO;
...@@ -1816,9 +1816,9 @@ static __cpuinit int mce_create_device(unsigned int cpu) ...@@ -1816,9 +1816,9 @@ static __cpuinit int mce_create_device(unsigned int cpu)
if (err) if (err)
goto error; goto error;
} }
for (i = 0; i < banks; i++) { for (j = 0; j < banks; j++) {
err = sysdev_create_file(&per_cpu(mce_dev, cpu), err = sysdev_create_file(&per_cpu(mce_dev, cpu),
&bank_attrs[i]); &bank_attrs[j]);
if (err) if (err)
goto error2; goto error2;
} }
...@@ -1826,8 +1826,8 @@ static __cpuinit int mce_create_device(unsigned int cpu) ...@@ -1826,8 +1826,8 @@ static __cpuinit int mce_create_device(unsigned int cpu)
return 0; return 0;
error2: error2:
while (--i >= 0) while (--j >= 0)
sysdev_remove_file(&per_cpu(mce_dev, cpu), &bank_attrs[i]); sysdev_remove_file(&per_cpu(mce_dev, cpu), &bank_attrs[j]);
error: error:
while (--i >= 0) while (--i >= 0)
sysdev_remove_file(&per_cpu(mce_dev, cpu), mce_attrs[i]); sysdev_remove_file(&per_cpu(mce_dev, cpu), mce_attrs[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment