All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]X86:microcode: fix vfree()
@ 2009-06-07  5:18 Figo.zhang
  2009-06-07 14:01 ` Ingo Molnar
  0 siblings, 1 reply; 9+ messages in thread
From: Figo.zhang @ 2009-06-07  5:18 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Andrew Morton, Tigran Aivazian, lkml

 
vfree() does it's own 'NULL' check,so no need for check before
calling it.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
---  
arch/x86/kernel/microcode_amd.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 453b579..fe577fd 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -257,10 +257,9 @@ static int install_equiv_cpu_table(const u8 *buf)
 
 static void free_equiv_cpu_table(void)
 {
-	if (equiv_cpu_table) {
-		vfree(equiv_cpu_table);
-		equiv_cpu_table = NULL;
-	}
+	vfree(equiv_cpu_table);
+	equiv_cpu_table = NULL;
+	
 }
 
 static int generic_load_microcode(int cpu, const u8 *data, size_t size)
@@ -293,8 +292,7 @@ static int generic_load_microcode(int cpu, const u8 *data, size_t size)
 
 		mc_header = (struct microcode_header_amd *)mc;
 		if (get_matching_microcode(cpu, mc, new_rev)) {
-			if (new_mc)
-				vfree(new_mc);
+			vfree(new_mc);
 			new_rev = mc_header->patch_id;
 			new_mc  = mc;
 		} else
@@ -306,8 +304,7 @@ static int generic_load_microcode(int cpu, const u8 *data, size_t size)
 
 	if (new_mc) {
 		if (!leftover) {
-			if (uci->mc)
-				vfree(uci->mc);
+			vfree(uci->mc);
 			uci->mc = new_mc;
 			pr_debug("microcode: CPU%d found a matching microcode "
 				 "update with version 0x%x (current=0x%x)\n",



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

* Re: [PATCH]X86:microcode: fix vfree()
  2009-06-07  5:18 [PATCH]X86:microcode: fix vfree() Figo.zhang
@ 2009-06-07 14:01 ` Ingo Molnar
  2009-06-07 14:18   ` [PATCH RESEND]X86:microcode: " Figo.zhang
  0 siblings, 1 reply; 9+ messages in thread
From: Ingo Molnar @ 2009-06-07 14:01 UTC (permalink / raw)
  To: Figo.zhang, Dmitry Adamushko; +Cc: Andrew Morton, Tigran Aivazian, lkml


* Figo.zhang <figo1802@gmail.com> wrote:

>  
> vfree() does it's own 'NULL' check,so no need for check before
> calling it.

looks good, but:

 s/it's/its/
 s/check,so/check, so/

and:

>  static void free_equiv_cpu_table(void)
>  {
> -	if (equiv_cpu_table) {
> -		vfree(equiv_cpu_table);
> -		equiv_cpu_table = NULL;
> -	}
> +	vfree(equiv_cpu_table);
> +	equiv_cpu_table = NULL;
> +	
>  }

stray newline and tab.

	Ingo

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

* [PATCH RESEND]X86:microcode: fix vfree()
  2009-06-07 14:01 ` Ingo Molnar
@ 2009-06-07 14:18   ` Figo.zhang
  2009-06-07 14:21     ` Ingo Molnar
  0 siblings, 1 reply; 9+ messages in thread
From: Figo.zhang @ 2009-06-07 14:18 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: lkml

vfree() does its own 'NULL' check, so no need for check before
calling it.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
---   
arch/x86/kernel/microcode_amd.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 453b579..8f52cf4 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -257,10 +257,9 @@ static int install_equiv_cpu_table(const u8 *buf)
 
 static void free_equiv_cpu_table(void)
 {
-	if (equiv_cpu_table) {
-		vfree(equiv_cpu_table);
-		equiv_cpu_table = NULL;
-	}
+	vfree(equiv_cpu_table);
+	equiv_cpu_table = NULL;
+
 }
 
 static int generic_load_microcode(int cpu, const u8 *data, size_t size)
@@ -293,8 +292,7 @@ static int generic_load_microcode(int cpu, const u8 *data, size_t size)
 
 		mc_header = (struct microcode_header_amd *)mc;
 		if (get_matching_microcode(cpu, mc, new_rev)) {
-			if (new_mc)
-				vfree(new_mc);
+			vfree(new_mc);
 			new_rev = mc_header->patch_id;
 			new_mc  = mc;
 		} else
@@ -306,8 +304,7 @@ static int generic_load_microcode(int cpu, const u8 *data, size_t size)
 
 	if (new_mc) {
 		if (!leftover) {
-			if (uci->mc)
-				vfree(uci->mc);
+			vfree(uci->mc);
 			uci->mc = new_mc;
 			pr_debug("microcode: CPU%d found a matching microcode "
 				 "update with version 0x%x (current=0x%x)\n",



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

* Re: [PATCH RESEND]X86:microcode: fix vfree()
  2009-06-07 14:18   ` [PATCH RESEND]X86:microcode: " Figo.zhang
@ 2009-06-07 14:21     ` Ingo Molnar
  2009-06-07 14:25       ` Figo.zhang
  2009-06-07 14:30       ` [PATCH v2]X86:microcode: " Figo.zhang
  0 siblings, 2 replies; 9+ messages in thread
From: Ingo Molnar @ 2009-06-07 14:21 UTC (permalink / raw)
  To: Figo.zhang; +Cc: lkml


(Note: it's not a 'resend', it's v2 of the patch)

* Figo.zhang <figo1802@gmail.com> wrote:

> vfree() does its own 'NULL' check, so no need for check before
> calling it.
> 
> Signed-off-by: Figo.zhang <figo1802@gmail.com>
> ---   
> arch/x86/kernel/microcode_amd.c |   13 +++++--------
>  1 files changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
> index 453b579..8f52cf4 100644
> --- a/arch/x86/kernel/microcode_amd.c
> +++ b/arch/x86/kernel/microcode_amd.c
> @@ -257,10 +257,9 @@ static int install_equiv_cpu_table(const u8 *buf)
>  
>  static void free_equiv_cpu_table(void)
>  {
> -	if (equiv_cpu_table) {
> -		vfree(equiv_cpu_table);
> -		equiv_cpu_table = NULL;
> -	}
> +	vfree(equiv_cpu_table);
> +	equiv_cpu_table = NULL;
> +

you fixed the tab but you didnt remove the stray newline :)

	Ingo

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

* Re: [PATCH RESEND]X86:microcode: fix vfree()
  2009-06-07 14:21     ` Ingo Molnar
@ 2009-06-07 14:25       ` Figo.zhang
  2009-06-07 14:28         ` Ingo Molnar
  2009-06-07 14:30       ` [PATCH v2]X86:microcode: " Figo.zhang
  1 sibling, 1 reply; 9+ messages in thread
From: Figo.zhang @ 2009-06-07 14:25 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: lkml

On Sun, 2009-06-07 at 16:21 +0200, Ingo Molnar wrote:
> (Note: it's not a 'resend', it's v2 of the patch)
> 
> * Figo.zhang <figo1802@gmail.com> wrote:
> 
> > vfree() does its own 'NULL' check, so no need for check before
> > calling it.
> > 
> > Signed-off-by: Figo.zhang <figo1802@gmail.com>
> > ---   
> > arch/x86/kernel/microcode_amd.c |   13 +++++--------
> >  1 files changed, 5 insertions(+), 8 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
> > index 453b579..8f52cf4 100644
> > --- a/arch/x86/kernel/microcode_amd.c
> > +++ b/arch/x86/kernel/microcode_amd.c
> > @@ -257,10 +257,9 @@ static int install_equiv_cpu_table(const u8 *buf)
> >  
> >  static void free_equiv_cpu_table(void)
> >  {
> > -	if (equiv_cpu_table) {
> > -		vfree(equiv_cpu_table);
> > -		equiv_cpu_table = NULL;
> > -	}
> > +	vfree(equiv_cpu_table);
> > +	equiv_cpu_table = NULL;
> > +

i motify by vim, you said this line?

Best Regards,

Figo.zhang

> 
> you fixed the tab but you didnt remove the stray newline :)
> 
> 	Ingo




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

* Re: [PATCH RESEND]X86:microcode: fix vfree()
  2009-06-07 14:25       ` Figo.zhang
@ 2009-06-07 14:28         ` Ingo Molnar
  0 siblings, 0 replies; 9+ messages in thread
From: Ingo Molnar @ 2009-06-07 14:28 UTC (permalink / raw)
  To: Figo.zhang; +Cc: lkml


* Figo.zhang <figo1802@gmail.com> wrote:

> On Sun, 2009-06-07 at 16:21 +0200, Ingo Molnar wrote:
> > (Note: it's not a 'resend', it's v2 of the patch)
> > 
> > * Figo.zhang <figo1802@gmail.com> wrote:
> > 
> > > vfree() does its own 'NULL' check, so no need for check before
> > > calling it.
> > > 
> > > Signed-off-by: Figo.zhang <figo1802@gmail.com>
> > > ---   
> > > arch/x86/kernel/microcode_amd.c |   13 +++++--------
> > >  1 files changed, 5 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
> > > index 453b579..8f52cf4 100644
> > > --- a/arch/x86/kernel/microcode_amd.c
> > > +++ b/arch/x86/kernel/microcode_amd.c
> > > @@ -257,10 +257,9 @@ static int install_equiv_cpu_table(const u8 *buf)
> > >  
> > >  static void free_equiv_cpu_table(void)
> > >  {
> > > -	if (equiv_cpu_table) {
> > > -		vfree(equiv_cpu_table);
> > > -		equiv_cpu_table = NULL;
> > > -	}
> > > +	vfree(equiv_cpu_table);
> > > +	equiv_cpu_table = NULL;
> > > +
> 
> i motify by vim, you said this line?

yes, that extra empty newline should not be there. (i.e. the line 
should be removed)
 
	Ingo

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

* [PATCH v2]X86:microcode: fix vfree()
  2009-06-07 14:21     ` Ingo Molnar
  2009-06-07 14:25       ` Figo.zhang
@ 2009-06-07 14:30       ` Figo.zhang
  2009-06-07 14:42         ` [tip:x86/microcode] x86, microcode: Simplify vfree() use tip-bot for Figo.zhang
  2009-06-10 14:23         ` [PATCH v2]X86:microcode: fix vfree() Figo.zhang
  1 sibling, 2 replies; 9+ messages in thread
From: Figo.zhang @ 2009-06-07 14:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: lkml

vfree() does its own 'NULL' check, so no need for check before
calling it.

In v2, remove the stray newline.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
---  
arch/x86/kernel/microcode_amd.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 453b579..06fce9d 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -257,10 +257,8 @@ static int install_equiv_cpu_table(const u8 *buf)
 
 static void free_equiv_cpu_table(void)
 {
-	if (equiv_cpu_table) {
-		vfree(equiv_cpu_table);
-		equiv_cpu_table = NULL;
-	}
+	vfree(equiv_cpu_table);
+	equiv_cpu_table = NULL;
 }
 
 static int generic_load_microcode(int cpu, const u8 *data, size_t size)
@@ -293,8 +291,7 @@ static int generic_load_microcode(int cpu, const u8 *data, size_t size)
 
 		mc_header = (struct microcode_header_amd *)mc;
 		if (get_matching_microcode(cpu, mc, new_rev)) {
-			if (new_mc)
-				vfree(new_mc);
+			vfree(new_mc);
 			new_rev = mc_header->patch_id;
 			new_mc  = mc;
 		} else
@@ -306,8 +303,7 @@ static int generic_load_microcode(int cpu, const u8 *data, size_t size)
 
 	if (new_mc) {
 		if (!leftover) {
-			if (uci->mc)
-				vfree(uci->mc);
+			vfree(uci->mc);
 			uci->mc = new_mc;
 			pr_debug("microcode: CPU%d found a matching microcode "
 				 "update with version 0x%x (current=0x%x)\n",



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

* [tip:x86/microcode] x86, microcode: Simplify vfree() use
  2009-06-07 14:30       ` [PATCH v2]X86:microcode: " Figo.zhang
@ 2009-06-07 14:42         ` tip-bot for Figo.zhang
  2009-06-10 14:23         ` [PATCH v2]X86:microcode: fix vfree() Figo.zhang
  1 sibling, 0 replies; 9+ messages in thread
From: tip-bot for Figo.zhang @ 2009-06-07 14:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, figo1802, dmitry.adamushko, tglx, mingo

Commit-ID:  aeef50bc0483fa70ce0bddb686ec84a274b7f3d4
Gitweb:     http://git.kernel.org/tip/aeef50bc0483fa70ce0bddb686ec84a274b7f3d4
Author:     Figo.zhang <figo1802@gmail.com>
AuthorDate: Sun, 7 Jun 2009 22:30:36 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 7 Jun 2009 16:35:11 +0200

x86, microcode: Simplify vfree() use

vfree() does its own 'NULL' check, so no need for check before
calling it.

In v2, remove the stray newline.

[ Impact: cleanup ]

Signed-off-by: Figo.zhang <figo1802@gmail.com>
Cc: Dmitry Adamushko <dmitry.adamushko@gmail.com>
LKML-Reference: <1244385036.3402.11.camel@myhost>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/microcode_amd.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index c8be20f..366baa1 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -241,10 +241,8 @@ static int install_equiv_cpu_table(const u8 *buf)
 
 static void free_equiv_cpu_table(void)
 {
-	if (equiv_cpu_table) {
-		vfree(equiv_cpu_table);
-		equiv_cpu_table = NULL;
-	}
+	vfree(equiv_cpu_table);
+	equiv_cpu_table = NULL;
 }
 
 static enum ucode_state
@@ -279,8 +277,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
 
 		mc_header = (struct microcode_header_amd *)mc;
 		if (get_matching_microcode(cpu, mc, new_rev)) {
-			if (new_mc)
-				vfree(new_mc);
+			vfree(new_mc);
 			new_rev = mc_header->patch_id;
 			new_mc  = mc;
 		} else
@@ -292,8 +289,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
 
 	if (new_mc) {
 		if (!leftover) {
-			if (uci->mc)
-				vfree(uci->mc);
+			vfree(uci->mc);
 			uci->mc = new_mc;
 			pr_debug("microcode: CPU%d found a matching microcode "
 				 "update with version 0x%x (current=0x%x)\n",

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

* Re: [PATCH v2]X86:microcode: fix vfree()
  2009-06-07 14:30       ` [PATCH v2]X86:microcode: " Figo.zhang
  2009-06-07 14:42         ` [tip:x86/microcode] x86, microcode: Simplify vfree() use tip-bot for Figo.zhang
@ 2009-06-10 14:23         ` Figo.zhang
  1 sibling, 0 replies; 9+ messages in thread
From: Figo.zhang @ 2009-06-10 14:23 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: lkml

On Sun, 2009-06-07 at 22:30 +0800, Figo.zhang wrote:
> Ingo

hi, Ingo,
    is it ok for v2?

Best Regards,

Figo.zhang


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

end of thread, other threads:[~2009-06-10 14:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-07  5:18 [PATCH]X86:microcode: fix vfree() Figo.zhang
2009-06-07 14:01 ` Ingo Molnar
2009-06-07 14:18   ` [PATCH RESEND]X86:microcode: " Figo.zhang
2009-06-07 14:21     ` Ingo Molnar
2009-06-07 14:25       ` Figo.zhang
2009-06-07 14:28         ` Ingo Molnar
2009-06-07 14:30       ` [PATCH v2]X86:microcode: " Figo.zhang
2009-06-07 14:42         ` [tip:x86/microcode] x86, microcode: Simplify vfree() use tip-bot for Figo.zhang
2009-06-10 14:23         ` [PATCH v2]X86:microcode: fix vfree() Figo.zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.