Skip to content

Commit ff6defa

Browse files
elfringtiwai
authored andcommitted
ALSA: Deletion of checks before the function call "iounmap"
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>
1 parent b76c0e9 commit ff6defa

26 files changed

Lines changed: 43 additions & 90 deletions

File tree

‎sound/aoa/soundbus/i2sbus/core.c‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,9 @@ static void i2sbus_release_dev(struct device *dev)
7474
int i;
7575

7676
i2sdev = container_of(dev, struct i2sbus_dev, sound.ofdev.dev);
77-
78-
if (i2sdev->intfregs) iounmap(i2sdev->intfregs);
79-
if (i2sdev->out.dbdma) iounmap(i2sdev->out.dbdma);
80-
if (i2sdev->in.dbdma) iounmap(i2sdev->in.dbdma);
77+
iounmap(i2sdev->intfregs);
78+
iounmap(i2sdev->out.dbdma);
79+
iounmap(i2sdev->in.dbdma);
8180
for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++)
8281
release_and_free_resource(i2sdev->allocated_resource[i]);
8382
free_dbdma_descriptor_ring(i2sdev, &i2sdev->out.dbdma_ring);
@@ -318,9 +317,9 @@ static int i2sbus_add_dev(struct macio_dev *macio,
318317
free_irq(dev->interrupts[i], dev);
319318
free_dbdma_descriptor_ring(dev, &dev->out.dbdma_ring);
320319
free_dbdma_descriptor_ring(dev, &dev->in.dbdma_ring);
321-
if (dev->intfregs) iounmap(dev->intfregs);
322-
if (dev->out.dbdma) iounmap(dev->out.dbdma);
323-
if (dev->in.dbdma) iounmap(dev->in.dbdma);
320+
iounmap(dev->intfregs);
321+
iounmap(dev->out.dbdma);
322+
iounmap(dev->in.dbdma);
324323
for (i=0;i<3;i++)
325324
release_and_free_resource(dev->allocated_resource[i]);
326325
mutex_destroy(&dev->lock);

‎sound/arm/aaci.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,8 +889,8 @@ static int aaci_probe_ac97(struct aaci *aaci)
889889
static void aaci_free_card(struct snd_card *card)
890890
{
891891
struct aaci *aaci = card->private_data;
892-
if (aaci->base)
893-
iounmap(aaci->base);
892+
893+
iounmap(aaci->base);
894894
}
895895

896896
static struct aaci *aaci_init_card(struct amba_device *dev)

‎sound/drivers/ml403-ac97cr.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,7 @@ static int snd_ml403_ac97cr_free(struct snd_ml403_ac97cr *ml403_ac97cr)
10941094
if (ml403_ac97cr->capture_irq >= 0)
10951095
free_irq(ml403_ac97cr->capture_irq, ml403_ac97cr);
10961096
/* give back "port" */
1097-
if (ml403_ac97cr->port != NULL)
1098-
iounmap(ml403_ac97cr->port);
1097+
iounmap(ml403_ac97cr->port);
10991098
kfree(ml403_ac97cr);
11001099
PDEBUG(INIT_INFO, "free(): (done)\n");
11011100
return 0;

‎sound/isa/msnd/msnd_pinnacle.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,7 @@ static int snd_msnd_attach(struct snd_card *card)
627627
return 0;
628628

629629
err_release_region:
630-
if (chip->mappedbase)
631-
iounmap(chip->mappedbase);
630+
iounmap(chip->mappedbase);
632631
release_mem_region(chip->base, BUFFSIZE);
633632
release_region(chip->io, DSP_NUMIO);
634633
free_irq(chip->irq, chip);

‎sound/parisc/harmony.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -893,9 +893,7 @@ snd_harmony_free(struct snd_harmony *h)
893893
if (h->irq >= 0)
894894
free_irq(h->irq, h);
895895

896-
if (h->iobase)
897-
iounmap(h->iobase);
898-
896+
iounmap(h->iobase);
899897
kfree(h);
900898
return 0;
901899
}

‎sound/pci/ad1889.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -853,12 +853,9 @@ snd_ad1889_free(struct snd_ad1889 *chip)
853853
free_irq(chip->irq, chip);
854854

855855
skip_hw:
856-
if (chip->iobase)
857-
iounmap(chip->iobase);
858-
856+
iounmap(chip->iobase);
859857
pci_release_regions(chip->pci);
860858
pci_disable_device(chip->pci);
861-
862859
kfree(chip);
863860
return 0;
864861
}

‎sound/pci/asihpi/hpioctl.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,8 @@ void asihpi_adapter_remove(struct pci_dev *pci_dev)
541541
hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL);
542542

543543
/* unmap PCI memory space, mapped during device init. */
544-
for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) {
545-
if (pci.ap_mem_base[idx])
546-
iounmap(pci.ap_mem_base[idx]);
547-
}
544+
for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; ++idx)
545+
iounmap(pci.ap_mem_base[idx]);
548546

549547
if (pa->irq)
550548
free_irq(pa->irq, pa);

‎sound/pci/atiixp.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,8 +1585,7 @@ static int snd_atiixp_free(struct atiixp *chip)
15851585
__hw_end:
15861586
if (chip->irq >= 0)
15871587
free_irq(chip->irq, chip);
1588-
if (chip->remap_addr)
1589-
iounmap(chip->remap_addr);
1588+
iounmap(chip->remap_addr);
15901589
pci_release_regions(chip->pci);
15911590
pci_disable_device(chip->pci);
15921591
kfree(chip);

‎sound/pci/atiixp_modem.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,8 +1211,7 @@ static int snd_atiixp_free(struct atiixp_modem *chip)
12111211
__hw_end:
12121212
if (chip->irq >= 0)
12131213
free_irq(chip->irq, chip);
1214-
if (chip->remap_addr)
1215-
iounmap(chip->remap_addr);
1214+
iounmap(chip->remap_addr);
12161215
pci_release_regions(chip->pci);
12171216
pci_disable_device(chip->pci);
12181217
kfree(chip);

‎sound/pci/aw2/aw2-alsa.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,7 @@ static int snd_aw2_dev_free(struct snd_device *device)
229229
if (chip->irq >= 0)
230230
free_irq(chip->irq, (void *)chip);
231231
/* release the i/o ports & memory */
232-
if (chip->iobase_virt)
233-
iounmap(chip->iobase_virt);
234-
232+
iounmap(chip->iobase_virt);
235233
pci_release_regions(chip->pci);
236234
/* disable the PCI entry */
237235
pci_disable_device(chip->pci);

0 commit comments

Comments
 (0)