linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: X86 ML <x86@kernel.org>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/4] x86/microcode/intel: Simplify get_matching_sig()
Date: Sun, 17 May 2015 12:55:00 +0200	[thread overview]
Message-ID: <1431860101-14847-4-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1431860101-14847-1-git-send-email-bp@alien8.de>

From: Borislav Petkov <bp@suse.de>

Unclutter function, make it a bit more readable, drop local variables.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/microcode/intel_lib.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/intel_lib.c b/arch/x86/kernel/cpu/microcode/intel_lib.c
index 1ffe507931af..def9c935f3f9 100644
--- a/arch/x86/kernel/cpu/microcode/intel_lib.c
+++ b/arch/x86/kernel/cpu/microcode/intel_lib.c
@@ -133,24 +133,22 @@ EXPORT_SYMBOL_GPL(microcode_sanity_check);
  */
 int get_matching_sig(unsigned int csig, int cpf, void *mc)
 {
-	struct microcode_header_intel *mc_header = mc;
-	struct extended_sigtable *ext_header;
-	unsigned long total_size = get_totalsize(mc_header);
-	int ext_sigcount, i;
+	struct microcode_header_intel *mc_hdr = mc;
+	struct extended_sigtable *ext_hdr;
 	struct extended_signature *ext_sig;
+	int i;
 
-	if (cpu_signatures_match(csig, cpf, mc_header->sig, mc_header->pf))
+	if (cpu_signatures_match(csig, cpf, mc_hdr->sig, mc_hdr->pf))
 		return 1;
 
 	/* Look for ext. headers: */
-	if (total_size <= get_datasize(mc_header) + MC_HEADER_SIZE)
+	if (get_totalsize(mc_hdr) <= get_datasize(mc_hdr) + MC_HEADER_SIZE)
 		return 0;
 
-	ext_header = mc + get_datasize(mc_header) + MC_HEADER_SIZE;
-	ext_sigcount = ext_header->count;
-	ext_sig = (void *)ext_header + EXT_HEADER_SIZE;
+	ext_hdr = mc + get_datasize(mc_hdr) + MC_HEADER_SIZE;
+	ext_sig = (void *)ext_hdr + EXT_HEADER_SIZE;
 
-	for (i = 0; i < ext_sigcount; i++) {
+	for (i = 0; i < ext_hdr->count; i++) {
 		if (cpu_signatures_match(csig, cpf, ext_sig->sig, ext_sig->pf))
 			return 1;
 		ext_sig++;
-- 
2.3.5


  parent reply	other threads:[~2015-05-17 10:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-17 10:54 [PATCH 0/4] x86/microcode/intel: Some trivial cleanups Borislav Petkov
2015-05-17 10:54 ` [PATCH 1/4] x86/microcode/intel: Rename get_matching_microcode Borislav Petkov
2015-05-18  9:10   ` [tip:x86/microcode] " tip-bot for Borislav Petkov
2015-05-17 10:54 ` [PATCH 2/4] x86/microcode/intel: Simplify update_match_cpu() Borislav Petkov
2015-05-18  9:10   ` [tip:x86/microcode] " tip-bot for Borislav Petkov
2015-05-17 10:55 ` Borislav Petkov [this message]
2015-05-18  9:11   ` [tip:x86/microcode] x86/microcode/intel: Simplify get_matching_sig() tip-bot for Borislav Petkov
2015-05-17 10:55 ` [PATCH 4/4] x86/microcode/intel: Rename get_matching_sig() Borislav Petkov
2015-05-18  9:11   ` [tip:x86/microcode] x86/microcode/intel: Rename get_matching_sig( ) tip-bot for Borislav Petkov
2015-05-21  1:42 ` [PATCH 0/4] x86/microcode/intel: Some trivial cleanups Henrique de Moraes Holschuh

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=1431860101-14847-4-git-send-email-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quentin.casasnovas@oracle.com \
    --cc=x86@kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).