ALSA: Deletion of checks before the function call "iounmap"
authorMarkus Elfring <elfring@users.sourceforge.net>
Sat, 3 Jan 2015 21:55:54 +0000 (22:55 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sun, 4 Jan 2015 14:13:45 +0000 (15:13 +0100)
The iounmap() function performs also input parameter validation.
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>
26 files changed:
sound/aoa/soundbus/i2sbus/core.c
sound/arm/aaci.c
sound/drivers/ml403-ac97cr.c
sound/isa/msnd/msnd_pinnacle.c
sound/parisc/harmony.c
sound/pci/ad1889.c
sound/pci/asihpi/hpioctl.c
sound/pci/atiixp.c
sound/pci/atiixp_modem.c
sound/pci/aw2/aw2-alsa.c
sound/pci/bt87x.c
sound/pci/cs4281.c
sound/pci/cs46xx/cs46xx_lib.c
sound/pci/ctxfi/cthw20k1.c
sound/pci/ctxfi/cthw20k2.c
sound/pci/echoaudio/echoaudio.c
sound/pci/hda/hda_intel.c
sound/pci/lola/lola.c
sound/pci/mixart/mixart.c
sound/pci/nm256/nm256.c
sound/pci/rme9652/hdsp.c
sound/pci/rme9652/hdspm.c
sound/pci/rme9652/rme9652.c
sound/pci/sis7019.c
sound/pci/ymfpci/ymfpci_main.c
sound/ppc/pmac.c

index 837ba99..b9737fa 100644 (file)
@@ -74,10 +74,9 @@ static void i2sbus_release_dev(struct device *dev)
        int i;
 
        i2sdev = container_of(dev, struct i2sbus_dev, sound.ofdev.dev);
-
-       if (i2sdev->intfregs) iounmap(i2sdev->intfregs);
-       if (i2sdev->out.dbdma) iounmap(i2sdev->out.dbdma);
-       if (i2sdev->in.dbdma) iounmap(i2sdev->in.dbdma);
+       iounmap(i2sdev->intfregs);
+       iounmap(i2sdev->out.dbdma);
+       iounmap(i2sdev->in.dbdma);
        for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++)
                release_and_free_resource(i2sdev->allocated_resource[i]);
        free_dbdma_descriptor_ring(i2sdev, &i2sdev->out.dbdma_ring);
@@ -318,9 +317,9 @@ static int i2sbus_add_dev(struct macio_dev *macio,
                        free_irq(dev->interrupts[i], dev);
        free_dbdma_descriptor_ring(dev, &dev->out.dbdma_ring);
        free_dbdma_descriptor_ring(dev, &dev->in.dbdma_ring);
-       if (dev->intfregs) iounmap(dev->intfregs);
-       if (dev->out.dbdma) iounmap(dev->out.dbdma);
-       if (dev->in.dbdma) iounmap(dev->in.dbdma);
+       iounmap(dev->intfregs);
+       iounmap(dev->out.dbdma);
+       iounmap(dev->in.dbdma);
        for (i=0;i<3;i++)
                release_and_free_resource(dev->allocated_resource[i]);
        mutex_destroy(&dev->lock);
index 0e83a73..4140b1b 100644 (file)
@@ -889,8 +889,8 @@ static int aaci_probe_ac97(struct aaci *aaci)
 static void aaci_free_card(struct snd_card *card)
 {
        struct aaci *aaci = card->private_data;
-       if (aaci->base)
-               iounmap(aaci->base);
+
+       iounmap(aaci->base);
 }
 
 static struct aaci *aaci_init_card(struct amba_device *dev)
index ec01de1..bdcb572 100644 (file)
@@ -1094,8 +1094,7 @@ static int snd_ml403_ac97cr_free(struct snd_ml403_ac97cr *ml403_ac97cr)
        if (ml403_ac97cr->capture_irq >= 0)
                free_irq(ml403_ac97cr->capture_irq, ml403_ac97cr);
        /* give back "port" */
-       if (ml403_ac97cr->port != NULL)
-               iounmap(ml403_ac97cr->port);
+       iounmap(ml403_ac97cr->port);
        kfree(ml403_ac97cr);
        PDEBUG(INIT_INFO, "free(): (done)\n");
        return 0;
index 65b3682..4c07266 100644 (file)
@@ -627,8 +627,7 @@ static int snd_msnd_attach(struct snd_card *card)
        return 0;
 
 err_release_region:
-       if (chip->mappedbase)
-               iounmap(chip->mappedbase);
+       iounmap(chip->mappedbase);
        release_mem_region(chip->base, BUFFSIZE);
        release_region(chip->io, DSP_NUMIO);
        free_irq(chip->irq, chip);
index 29604a2..f2350c1 100644 (file)
@@ -893,9 +893,7 @@ snd_harmony_free(struct snd_harmony *h)
        if (h->irq >= 0)
                free_irq(h->irq, h);
 
-       if (h->iobase)
-               iounmap(h->iobase);
-
+       iounmap(h->iobase);
        kfree(h);
        return 0;
 }
index 547ee30..0de3129 100644 (file)
@@ -853,12 +853,9 @@ snd_ad1889_free(struct snd_ad1889 *chip)
                free_irq(chip->irq, chip);
 
 skip_hw:
-       if (chip->iobase)
-               iounmap(chip->iobase);
-
+       iounmap(chip->iobase);
        pci_release_regions(chip->pci);
        pci_disable_device(chip->pci);
-
        kfree(chip);
        return 0;
 }
index 72af66b..67d1133 100644 (file)
@@ -541,10 +541,8 @@ void asihpi_adapter_remove(struct pci_dev *pci_dev)
        hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL);
 
        /* unmap PCI memory space, mapped during device init. */
-       for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) {
-               if (pci.ap_mem_base[idx])
-                       iounmap(pci.ap_mem_base[idx]);
-       }
+       for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; ++idx)
+               iounmap(pci.ap_mem_base[idx]);
 
        if (pa->irq)
                free_irq(pa->irq, pa);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge