]> git.karo-electronics.de Git - linux-beck.git/commitdiff
x86, microcode: Correct sysdev_add error path
authorBorislav Petkov <borislav.petkov@amd.com>
Thu, 6 Jan 2011 15:56:51 +0000 (16:56 +0100)
committerBorislav Petkov <borislav.petkov@amd.com>
Wed, 9 Feb 2011 15:05:31 +0000 (16:05 +0100)
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>
arch/x86/kernel/microcode_core.c

index 1cca374a2bacc8f1f5275847ef4d4cd2787c0545..87af68e0e1e1458a00d90d7e95e6755a4a332aa4 100644 (file)
@@ -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;
 }