LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Borislav Petkov <bp@amd64.org>
To: <x86@kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	Borislav Petkov <borislav.petkov@amd.com>,
	Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Subject: [PATCH 2/7] x86, microcode: Correct sysdev_add error path
Date: Mon, 24 Jan 2011 16:28:58 +0100	[thread overview]
Message-ID: <1295882943-11184-3-git-send-email-bp@amd64.org> (raw)
In-Reply-To: <1295882943-11184-1-git-send-email-bp@amd64.org>

From: Borislav Petkov <borislav.petkov@amd.com>

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 |    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 1cca374..87af68e 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;
 }
-- 
1.7.4.rc2


  parent reply	other threads:[~2011-01-24 15:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 15:28 [PATCH 0/7] x86, microcode, AMD: Some fixes Borislav Petkov
2011-01-24 15:28 ` [PATCH 1/7] sysdev: Do not register with sysdev when erroring on add Borislav Petkov
2011-01-26 12:00   ` Borislav Petkov
2011-01-31 22:16   ` Greg KH
2011-01-31 22:33     ` Borislav Petkov
2011-01-31 22:50       ` Greg KH
2011-01-24 15:28 ` Borislav Petkov [this message]
2011-01-24 15:28 ` [PATCH 3/7] x86, microcode, AMD: Release firmware on error Borislav Petkov
2011-01-24 15:29 ` [PATCH 4/7] x86, microcode, AMD: Simplify install_equiv_cpu_table Borislav Petkov
2011-01-24 15:29 ` [PATCH 5/7] x86, microcode, AMD: Simplify get_next_ucode Borislav Petkov
2011-01-24 15:29 ` [PATCH 6/7] x86, microcode, AMD: Remove unneeded memset call Borislav Petkov
2011-01-24 15:29 ` [PATCH 7/7] x86, microcode, AMD: Cleanup dmesg output Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295882943-11184-3-git-send-email-bp@amd64.org \
    --to=bp@amd64.org \
    --cc=borislav.petkov@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tigran@aivazian.fsnet.co.uk \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH 2/7] x86, microcode: Correct sysdev_add error path' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).