public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -tip] microcode, AMD: Cleanup code a bit
@ 2010-11-02 17:52 Borislav Petkov
  2010-11-10  8:31 ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2010-11-02 17:52 UTC (permalink / raw)
  To: Ingo Molnar, H. Peter Anvin, Thomas Gleixner
  Cc: Jesper Juhl, amd64-microcode, LKML

get_ucode_data is a memcpy() wrapper which always returns 0. Move it
into the header and make it an inline. Remove all code checking its
return value and turn it into a void.

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
 arch/x86/include/asm/microcode.h |    6 ++++++
 arch/x86/kernel/microcode_amd.c  |   25 +++++--------------------
 2 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
index ef51b50..2421507 100644
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -48,6 +48,12 @@ static inline struct microcode_ops * __init init_intel_microcode(void)
 
 #ifdef CONFIG_MICROCODE_AMD
 extern struct microcode_ops * __init init_amd_microcode(void);
+
+static inline void get_ucode_data(void *to, const u8 *from, size_t n)
+{
+	memcpy(to, from, n);
+}
+
 #else
 static inline struct microcode_ops * __init init_amd_microcode(void)
 {
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 383d4f8..15831336 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -155,12 +155,6 @@ static int apply_microcode_amd(int cpu)
 	return 0;
 }
 
-static int get_ucode_data(void *to, const u8 *from, size_t n)
-{
-	memcpy(to, from, n);
-	return 0;
-}
-
 static void *
 get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
 {
@@ -168,8 +162,7 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
 	u8 section_hdr[UCODE_CONTAINER_SECTION_HDR];
 	void *mc;
 
-	if (get_ucode_data(section_hdr, buf, UCODE_CONTAINER_SECTION_HDR))
-		return NULL;
+	get_ucode_data(section_hdr, buf, UCODE_CONTAINER_SECTION_HDR);
 
 	if (section_hdr[0] != UCODE_UCODE_TYPE) {
 		pr_err("error: invalid type field in container file section header\n");
@@ -187,12 +180,8 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
 	if (!mc)
 		return NULL;
 
-	if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR, total_size)) {
-		vfree(mc);
-		mc = NULL;
-	} else {
-		*mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
-	}
+	get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR, total_size);
+	*mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
 
 	return mc;
 }
@@ -203,8 +192,7 @@ static int install_equiv_cpu_table(const u8 *buf)
 	unsigned int *buf_pos = (unsigned int *)container_hdr;
 	unsigned long size;
 
-	if (get_ucode_data(&container_hdr, buf, UCODE_CONTAINER_HEADER_SIZE))
-		return 0;
+	get_ucode_data(&container_hdr, buf, UCODE_CONTAINER_HEADER_SIZE);
 
 	size = buf_pos[2];
 
@@ -220,10 +208,7 @@ static int install_equiv_cpu_table(const u8 *buf)
 	}
 
 	buf += UCODE_CONTAINER_HEADER_SIZE;
-	if (get_ucode_data(equiv_cpu_table, buf, size)) {
-		vfree(equiv_cpu_table);
-		return 0;
-	}
+	get_ucode_data(equiv_cpu_table, buf, size);
 
 	return size + UCODE_CONTAINER_HEADER_SIZE; /* add header length */
 }
-- 
1.7.3.1.50.g1e633


-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -tip] microcode, AMD: Cleanup code a bit
  2010-11-02 17:52 [PATCH -tip] microcode, AMD: Cleanup code a bit Borislav Petkov
@ 2010-11-10  8:31 ` Ingo Molnar
  2010-11-10 11:33   ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2010-11-10  8:31 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: H. Peter Anvin, Thomas Gleixner, Jesper Juhl, amd64-microcode,
	LKML


* Borislav Petkov <bp@amd64.org> wrote:

> get_ucode_data is a memcpy() wrapper which always returns 0. Move it
> into the header and make it an inline. Remove all code checking its
> return value and turn it into a void.
> 
> There should be no functionality change resulting from this patch.
> 
> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
> ---
>  arch/x86/include/asm/microcode.h |    6 ++++++
>  arch/x86/kernel/microcode_amd.c  |   25 +++++--------------------
>  2 files changed, 11 insertions(+), 20 deletions(-)

Hm, what tree is this against - it doesnt apply here:

 Hunk #3 FAILED at 180.
 Hunk #4 succeeded at 195 (offset -1 lines).
 Hunk #5 succeeded at 211 (offset -1 lines).
 1 out of 5 hunks FAILED -- rejects in file arch/x86/kernel/microcode_amd.c

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -tip] microcode, AMD: Cleanup code a bit
  2010-11-10  8:31 ` Ingo Molnar
@ 2010-11-10 11:33   ` Borislav Petkov
  2010-11-10 13:22     ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2010-11-10 11:33 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: H. Peter Anvin, Thomas Gleixner, Jesper Juhl,
	amd64-microcode@amd64.org, LKML

On Wed, Nov 10, 2010 at 03:31:21AM -0500, Ingo Molnar wrote:
> Hm, what tree is this against - it doesnt apply here:

Ah, there's this one other patch that goes before that, sorry for not
mentioning it to you - I guess you still cannot read minds :-)

http://marc.info/?l=linux-kernel&m=128864852428104

Anyway, I've applied the two ontop of tip/x86/microcode and uploaded
them to

git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git tip-microcode


Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -tip] microcode, AMD: Cleanup code a bit
  2010-11-10 11:33   ` Borislav Petkov
@ 2010-11-10 13:22     ` Ingo Molnar
  2010-11-10 13:59       ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2010-11-10 13:22 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: H. Peter Anvin, Thomas Gleixner, Jesper Juhl,
	amd64-microcode@amd64.org, LKML


* Borislav Petkov <bp@amd64.org> wrote:

> On Wed, Nov 10, 2010 at 03:31:21AM -0500, Ingo Molnar wrote:
> > Hm, what tree is this against - it doesnt apply here:
> 
> Ah, there's this one other patch that goes before that, sorry for not
> mentioning it to you - I guess you still cannot read minds :-)
> 
> http://marc.info/?l=linux-kernel&m=128864852428104
> 
> Anyway, I've applied the two ontop of tip/x86/microcode and uploaded
> them to
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git tip-microcode

Ok, good. Please fix commit 35dc0ff46f77 if you want me to pull it, you should be in 
the signoff chain as a submaintainer who pushes bits, i.e. your entry should be:

  Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>

not:

  Acked-by: Borislav Petkov <borislav.petkov@amd.com>

Also, while touching up details, please remove the colon after the sentence:

  35dc0ff46f77: microcode, AMD: Prefer vzalloc() over calls to vmalloc()+memset().

All arch/x86 commit titles are open-ended sentences that start with a verb.

Also, please use a 'x86, microcode, AMD: ' prefix.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -tip] microcode, AMD: Cleanup code a bit
  2010-11-10 13:22     ` Ingo Molnar
@ 2010-11-10 13:59       ` Borislav Petkov
  2010-11-10 14:08         ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2010-11-10 13:59 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: H. Peter Anvin, Thomas Gleixner, Jesper Juhl,
	amd64-microcode@amd64.org, LKML

On Wed, Nov 10, 2010 at 08:22:46AM -0500, Ingo Molnar wrote:
> > git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git tip-microcode
> 
> Ok, good. Please fix commit 35dc0ff46f77 if you want me to pull it, you should be in 
> the signoff chain as a submaintainer who pushes bits, i.e. your entry should be:
> 
>   Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
> 
> not:
> 
>   Acked-by: Borislav Petkov <borislav.petkov@amd.com>

done,

> Also, while touching up details, please remove the colon after the sentence:
> 
>   35dc0ff46f77: microcode, AMD: Prefer vzalloc() over calls to vmalloc()+memset().

done (simplified commit message, while at it),

> All arch/x86 commit titles are open-ended sentences that start with a verb.
> 
> Also, please use a 'x86, microcode, AMD: ' prefix.

and done. Branch updated.

Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -tip] microcode, AMD: Cleanup code a bit
  2010-11-10 13:59       ` Borislav Petkov
@ 2010-11-10 14:08         ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2010-11-10 14:08 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: H. Peter Anvin, Thomas Gleixner, Jesper Juhl,
	amd64-microcode@amd64.org, LKML


* Borislav Petkov <bp@amd64.org> wrote:

> On Wed, Nov 10, 2010 at 08:22:46AM -0500, Ingo Molnar wrote:
> > > git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git tip-microcode
> > 
> > Ok, good. Please fix commit 35dc0ff46f77 if you want me to pull it, you should be in 
> > the signoff chain as a submaintainer who pushes bits, i.e. your entry should be:
> > 
> >   Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
> > 
> > not:
> > 
> >   Acked-by: Borislav Petkov <borislav.petkov@amd.com>
> 
> done,
> 
> > Also, while touching up details, please remove the colon after the sentence:
> > 
> >   35dc0ff46f77: microcode, AMD: Prefer vzalloc() over calls to vmalloc()+memset().
> 
> done (simplified commit message, while at it),
> 
> > All arch/x86 commit titles are open-ended sentences that start with a verb.
> > 
> > Also, please use a 'x86, microcode, AMD: ' prefix.
> 
> and done. Branch updated.

Pulled, thanks Boris!

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-11-10 14:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-02 17:52 [PATCH -tip] microcode, AMD: Cleanup code a bit Borislav Petkov
2010-11-10  8:31 ` Ingo Molnar
2010-11-10 11:33   ` Borislav Petkov
2010-11-10 13:22     ` Ingo Molnar
2010-11-10 13:59       ` Borislav Petkov
2010-11-10 14:08         ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox