diff options
author | Borislav Petkov <borislav.petkov@amd.com> | 2011-01-06 16:56:51 +0100 |
---|---|---|
committer | Borislav Petkov <borislav.petkov@amd.com> | 2011-02-09 16:05:31 +0100 |
commit | 6c53cbfced048c421e4f72cb2183465f68fbc5e7 (patch) | |
tree | e7d5529cf13e06d5e488aab6237eec37d01a0c94 /arch/x86/kernel/microcode_core.c | |
parent | 100b33c8bd8a3235fd0b7948338d6cbb3db3c63d (diff) |
x86, microcode: Correct sysdev_add error path
When we encounter an error while initting the microcode driver on a CPU,
we must undo the previously added sysfs group.
Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Acked-by: Andreas Herrmann <Andreas.Herrmann3@amd.com>
Diffstat (limited to 'arch/x86/kernel/microcode_core.c')
-rw-r--r-- | arch/x86/kernel/microcode_core.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index 1cca374a2ba..87af68e0e1e 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c @@ -417,8 +417,10 @@ static int mc_sysdev_add(struct sys_device *sys_dev) if (err) return err; - if (microcode_init_cpu(cpu) == UCODE_ERROR) - err = -EINVAL; + if (microcode_init_cpu(cpu) == UCODE_ERROR) { + sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); + return -EINVAL; + } return err; } |