public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 07/13] maestro3 vfree NULL check fixup
@ 2006-02-24 20:48 Jesper Juhl
  2006-02-24 21:09 ` Zach Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2006-02-24 20:48 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Zach Brown, Jesper Juhl


vfree() checks for NULL, no need to do it explicitly.


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com
---

 sound/oss/maestro3.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

--- linux-2.6.16-rc4-mm2-orig/sound/oss/maestro3.c	2006-02-24 19:25:49.000000000 +0100
+++ linux-2.6.16-rc4-mm2/sound/oss/maestro3.c	2006-02-24 20:59:19.000000000 +0100
@@ -2582,10 +2582,10 @@ static int alloc_dsp_suspendmem(struct m
 
     return 0;
 }
+
 static void free_dsp_suspendmem(struct m3_card *card)
 {
-   if(card->suspend_mem)
-       vfree(card->suspend_mem);
+    vfree(card->suspend_mem);
 }
 
 #else




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

* Re: [PATCH 07/13] maestro3 vfree NULL check fixup
  2006-02-24 20:48 [PATCH 07/13] maestro3 vfree NULL check fixup Jesper Juhl
@ 2006-02-24 21:09 ` Zach Brown
  2006-02-24 21:17   ` Jesper Juhl
  0 siblings, 1 reply; 6+ messages in thread
From: Zach Brown @ 2006-02-24 21:09 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: Andrew Morton, linux-kernel

Jesper Juhl wrote:
> vfree() checks for NULL, no need to do it explicitly.

>  static void free_dsp_suspendmem(struct m3_card *card)
>  {
> -   if(card->suspend_mem)
> -       vfree(card->suspend_mem);
> +    vfree(card->suspend_mem);
>  }

eh, I'd just get rid of the helper and call vfree() from both sites.

- z

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

* Re: [PATCH 07/13] maestro3 vfree NULL check fixup
  2006-02-24 21:09 ` Zach Brown
@ 2006-02-24 21:17   ` Jesper Juhl
  2006-02-24 21:18     ` Jesper Juhl
  0 siblings, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2006-02-24 21:17 UTC (permalink / raw)
  To: Zach Brown; +Cc: Andrew Morton, linux-kernel

On Friday 24 February 2006 22:09, Zach Brown wrote:
> Jesper Juhl wrote:
> > vfree() checks for NULL, no need to do it explicitly.
> 
> >  static void free_dsp_suspendmem(struct m3_card *card)
> >  {
> > -   if(card->suspend_mem)
> > -       vfree(card->suspend_mem);
> > +    vfree(card->suspend_mem);
> >  }
> 
> eh, I'd just get rid of the helper and call vfree() from both sites.
> 
makes perfect sense, I just looked for vfree use - should have checked more 
in-depth.

Here's an updated patch : 



Don't check pointers for NULL before calling vfree and get rid
of pointless helper function in sound/oss/maestro3.c


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

 sound/oss/maestro3.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

--- linux-2.6.16-rc4-mm2-orig/sound/oss/maestro3.c	2006-02-24 19:25:49.000000000 +0100
+++ linux-2.6.16-rc4-mm2/sound/oss/maestro3.c	2006-02-24 22:12:27.000000000 +0100
@@ -2582,15 +2582,9 @@ static int alloc_dsp_suspendmem(struct m
 
     return 0;
 }
-static void free_dsp_suspendmem(struct m3_card *card)
-{
-   if(card->suspend_mem)
-       vfree(card->suspend_mem);
-}
 
 #else
 #define alloc_dsp_suspendmem(args...) 0
-#define free_dsp_suspendmem(args...) 
 #endif
 
 /*
@@ -2717,7 +2711,7 @@ out:
     if(ret) {
         if(card->iobase)
             release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0));
-        free_dsp_suspendmem(card);
+        vfree(card);
         if(card->ac97) {
             unregister_sound_mixer(card->ac97->dev_mixer);
             kfree(card->ac97);
@@ -2760,7 +2754,7 @@ static void m3_remove(struct pci_dev *pc
         }
 
         release_region(card->iobase, 256);
-        free_dsp_suspendmem(card);
+        vfree(card);
         kfree(card);
     }
     devs = NULL;




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

* Re: [PATCH 07/13] maestro3 vfree NULL check fixup
  2006-02-24 21:17   ` Jesper Juhl
@ 2006-02-24 21:18     ` Jesper Juhl
  2006-02-24 21:22       ` Jesper Juhl
  0 siblings, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2006-02-24 21:18 UTC (permalink / raw)
  To: Zach Brown; +Cc: Andrew Morton, linux-kernel

On 2/24/06, Jesper Juhl <jesper.juhl@gmail.com> wrote:
> On Friday 24 February 2006 22:09, Zach Brown wrote:
> > Jesper Juhl wrote:
> > > vfree() checks for NULL, no need to do it explicitly.
> >
> > >  static void free_dsp_suspendmem(struct m3_card *card)
> > >  {
> > > -   if(card->suspend_mem)
> > > -       vfree(card->suspend_mem);
> > > +    vfree(card->suspend_mem);
> > >  }
> >
> > eh, I'd just get rid of the helper and call vfree() from both sites.
> >
> makes perfect sense, I just looked for vfree use - should have checked more
> in-depth.
>
> Here's an updated patch :
>
>
>
> Don't check pointers for NULL before calling vfree and get rid
> of pointless helper function in sound/oss/maestro3.c
>
>
> Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
> ---
>
>  sound/oss/maestro3.c |   10 ++--------
>  1 files changed, 2 insertions(+), 8 deletions(-)
>
> --- linux-2.6.16-rc4-mm2-orig/sound/oss/maestro3.c      2006-02-24 19:25:49.000000000 +0100
> +++ linux-2.6.16-rc4-mm2/sound/oss/maestro3.c   2006-02-24 22:12:27.000000000 +0100
> @@ -2582,15 +2582,9 @@ static int alloc_dsp_suspendmem(struct m
>
>      return 0;
>  }
> -static void free_dsp_suspendmem(struct m3_card *card)
> -{
> -   if(card->suspend_mem)
> -       vfree(card->suspend_mem);
> -}
>
>  #else
>  #define alloc_dsp_suspendmem(args...) 0
> -#define free_dsp_suspendmem(args...)
>  #endif
>
>  /*
> @@ -2717,7 +2711,7 @@ out:
>      if(ret) {
>          if(card->iobase)
>              release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0));
> -        free_dsp_suspendmem(card);
> +        vfree(card);
>          if(card->ac97) {
>              unregister_sound_mixer(card->ac97->dev_mixer);
>              kfree(card->ac97);
> @@ -2760,7 +2754,7 @@ static void m3_remove(struct pci_dev *pc
>          }
>
>          release_region(card->iobase, 256);
> -        free_dsp_suspendmem(card);
> +        vfree(card);
>          kfree(card);
>      }
>      devs = NULL;
>

Arrgh, I'm an idiot. That patch is wrong.

Sorry, updated patch in 2 min.

--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

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

* Re: [PATCH 07/13] maestro3 vfree NULL check fixup
  2006-02-24 21:18     ` Jesper Juhl
@ 2006-02-24 21:22       ` Jesper Juhl
  2006-02-24 21:25         ` Zach Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2006-02-24 21:22 UTC (permalink / raw)
  To: Zach Brown; +Cc: Andrew Morton, linux-kernel

On Friday 24 February 2006 22:18, Jesper Juhl wrote:
> On 2/24/06, Jesper Juhl <jesper.juhl@gmail.com> wrote:
> > On Friday 24 February 2006 22:09, Zach Brown wrote:
> > > Jesper Juhl wrote:
> > > > vfree() checks for NULL, no need to do it explicitly.
> > >
> > > >  static void free_dsp_suspendmem(struct m3_card *card)
> > > >  {
> > > > -   if(card->suspend_mem)
> > > > -       vfree(card->suspend_mem);
> > > > +    vfree(card->suspend_mem);
> > > >  }
> > >
> > > eh, I'd just get rid of the helper and call vfree() from both sites.
> > >
> > makes perfect sense, I just looked for vfree use - should have checked more
> > in-depth.
> >
[snip]
> Arrgh, I'm an idiot. That patch is wrong.
> 
> Sorry, updated patch in 2 min.
> 

Don't check pointers for NULL before calling vfree and get rid
of a pointless helper function in sound/oss/maestro3.c


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

 sound/oss/maestro3.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

--- linux-2.6.16-rc4-mm2-orig/sound/oss/maestro3.c	2006-02-24 19:25:49.000000000 +0100
+++ linux-2.6.16-rc4-mm2/sound/oss/maestro3.c	2006-02-24 22:19:48.000000000 +0100
@@ -2582,15 +2582,9 @@ static int alloc_dsp_suspendmem(struct m
 
     return 0;
 }
-static void free_dsp_suspendmem(struct m3_card *card)
-{
-   if(card->suspend_mem)
-       vfree(card->suspend_mem);
-}
 
 #else
 #define alloc_dsp_suspendmem(args...) 0
-#define free_dsp_suspendmem(args...) 
 #endif
 
 /*
@@ -2717,7 +2711,7 @@ out:
     if(ret) {
         if(card->iobase)
             release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0));
-        free_dsp_suspendmem(card);
+        vfree(card->suspend_mem);
         if(card->ac97) {
             unregister_sound_mixer(card->ac97->dev_mixer);
             kfree(card->ac97);
@@ -2760,7 +2754,7 @@ static void m3_remove(struct pci_dev *pc
         }
 
         release_region(card->iobase, 256);
-        free_dsp_suspendmem(card);
+        vfree(card->suspend_mem);
         kfree(card);
     }
     devs = NULL;




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

* Re: [PATCH 07/13] maestro3 vfree NULL check fixup
  2006-02-24 21:22       ` Jesper Juhl
@ 2006-02-24 21:25         ` Zach Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Zach Brown @ 2006-02-24 21:25 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: Andrew Morton, linux-kernel


> Don't check pointers for NULL before calling vfree and get rid
> of a pointless helper function in sound/oss/maestro3.c

Nice work, thanks.

Acked-by: Zach Brown <zab@zabbo.net>

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

end of thread, other threads:[~2006-02-24 21:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-24 20:48 [PATCH 07/13] maestro3 vfree NULL check fixup Jesper Juhl
2006-02-24 21:09 ` Zach Brown
2006-02-24 21:17   ` Jesper Juhl
2006-02-24 21:18     ` Jesper Juhl
2006-02-24 21:22       ` Jesper Juhl
2006-02-24 21:25         ` Zach Brown

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