ALSA: emu10k1: Deletion of unnecessary checks before three function calls
authorMarkus Elfring <elfring@users.sourceforge.net>
Mon, 3 Nov 2014 13:54:36 +0000 (14:54 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 3 Nov 2014 14:16:14 +0000 (15:16 +0100)
The functions kfree(), release_firmware() and snd_util_memhdr_free() test
whether their argument is NULL and then return immediately. Thus the test
around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/emu10k1/emu10k1_main.c
sound/pci/emu10k1/emufx.c

index 2292697880235b8dd6c440064ba9a7b266d6d370..b4458a630a7c260cce0e211bbd5ef9310a126605 100644 (file)
@@ -1289,10 +1289,8 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu)
        }
        if (emu->emu1010.firmware_thread)
                kthread_stop(emu->emu1010.firmware_thread);
-       if (emu->firmware)
-               release_firmware(emu->firmware);
-       if (emu->dock_fw)
-               release_firmware(emu->dock_fw);
+       release_firmware(emu->firmware);
+       release_firmware(emu->dock_fw);
        if (emu->irq >= 0)
                free_irq(emu->irq, emu);
        /* remove reserved page */
@@ -1301,8 +1299,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu)
                        (struct snd_util_memblk *)emu->reserved_page);
                emu->reserved_page = NULL;
        }
-       if (emu->memhdr)
-               snd_util_memhdr_free(emu->memhdr);
+       snd_util_memhdr_free(emu->memhdr);
        if (emu->silent_page.area)
                snd_dma_free_pages(&emu->silent_page);
        if (emu->ptb_pages.area)
index 745f0627c634eb0f678ba1eec736f091f50bce9f..eb5c0aba41c1a56d2d1bd07f8c63fed6da2e3835 100644 (file)
@@ -777,8 +777,7 @@ static void snd_emu10k1_ctl_private_free(struct snd_kcontrol *kctl)
        kctl->private_value = 0;
        list_del(&ctl->list);
        kfree(ctl);
-       if (kctl->tlv.p)
-               kfree(kctl->tlv.p);
+       kfree(kctl->tlv.p);
 }
 
 static int snd_emu10k1_add_controls(struct snd_emu10k1 *emu,