Skip to content

Commit

Permalink
x86, microcode: Correct sysdev_add error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Borislav Petkov committed Feb 9, 2011
1 parent 100b33c commit 6c53cbf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/x86/kernel/microcode_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 6c53cbf

Please sign in to comment.