Skip to contentSkip to conversation

maestro3 vfree NULL check fixup

PATCH In review Jesper Juhl 2 participants 6 messages Feb 24, 2006 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 7/13 maestro3 vfree NULL check fixup

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

---

 sound/oss/maestro3.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/oss/maestro3.c +2 -2
@@ -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
#1 lore raw

sound/oss/maestro3.c static int alloc_dsp_suspendmem(struct m · line 2589

Quoted 8 lines · Jesper Juhl

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

static void free_dsp_suspendmem(struct m3_card *card) {

sound/oss/maestro3.c +1 -2
-   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

#2 lore raw
Quoted 12 lines · Zach Brown

Review

Quoted 8 lines · Jesper Juhl

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

static void free_dsp_suspendmem(struct m3_card *card) {

(quoted diff) +1 -2
-   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

---

 sound/oss/maestro3.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
sound/oss/maestro3.c +2 -8
@@ -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;
#3 lore raw
Quoted 59 lines · Jesper Juhl
Quoted 12 lines · Zach Brown

sound/oss/maestro3.c static int alloc_dsp_suspendmem(struct m

Quoted 8 lines · Jesper Juhl

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

static void free_dsp_suspendmem(struct m3_card *card) {

sound/oss/maestro3.c +1 -2
-   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

---

 sound/oss/maestro3.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
sound/oss/maestro3.c 2006-02-24 22:12:27.000000000 +0100 renamed from sound/oss/maestro3.c 2006-02-24 19:25:49.000000000 +0100 +1 -7
@@ -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);

sound/oss/maestro3.c 2006-02-24 22:12:27.000000000 +0100 static void m3_remove(struct pci_dev *pc · line 2760

Quoted 8 lines
sound/oss/maestro3.c 2006-02-24 22:12:27.000000000 +0100 renamed from sound/oss/maestro3.c 2006-02-24 19:25:49.000000000 +0100 +1 -1
@@ -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 <[email protected]>
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

#4 lore raw
Quoted 17 lines · Jesper Juhl
Quoted 16 lines · Jesper Juhl
Quoted 12 lines · Zach Brown

Review

Quoted 8 lines · Jesper Juhl

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

static void free_dsp_suspendmem(struct m3_card *card) {

(quoted diff) +1 -2
-   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]

Quoted 4 lines

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

---

 sound/oss/maestro3.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
sound/oss/maestro3.c +2 -8
@@ -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;