Skip to content

Commit 78e4be1

Browse files
Amol LadDavid S. Miller
authored andcommitted
[ATM]: [drivers] ioremap balanced with iounmap
Signed-off-by: Amol Lad <amol@verismonetworks.com> Signed-off-by: chas williams <chas@cmf.nrl.navy.mil> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent de24a19 commit 78e4be1

2 files changed

Lines changed: 24 additions & 9 deletions

File tree

‎drivers/atm/eni.c‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,8 @@ static int __devinit eni_do_init(struct atm_dev *dev)
17381738
printk(KERN_ERR KERN_ERR DEV_LABEL "(itf %d): bad "
17391739
"magic - expected 0x%x, got 0x%x\n",dev->number,
17401740
ENI155_MAGIC,(unsigned) readl(&eprom->magic));
1741-
return -EINVAL;
1741+
error = -EINVAL;
1742+
goto unmap;
17421743
}
17431744
}
17441745
eni_dev->phy = base+PHY_BASE;
@@ -1765,17 +1766,27 @@ static int __devinit eni_do_init(struct atm_dev *dev)
17651766
printk(")\n");
17661767
printk(KERN_ERR DEV_LABEL "(itf %d): ERROR - wrong id 0x%x\n",
17671768
dev->number,(unsigned) eni_in(MID_RES_ID_MCON));
1768-
return -EINVAL;
1769+
error = -EINVAL;
1770+
goto unmap;
17691771
}
17701772
error = eni_dev->asic ? get_esi_asic(dev) : get_esi_fpga(dev,base);
1771-
if (error) return error;
1773+
if (error)
1774+
goto unmap;
17721775
for (i = 0; i < ESI_LEN; i++)
17731776
printk("%s%02X",i ? "-" : "",dev->esi[i]);
17741777
printk(")\n");
17751778
printk(KERN_NOTICE DEV_LABEL "(itf %d): %s,%s\n",dev->number,
17761779
eni_in(MID_RES_ID_MCON) & 0x200 ? "ASIC" : "FPGA",
17771780
media_name[eni_in(MID_RES_ID_MCON) & DAUGTHER_ID]);
1778-
return suni_init(dev);
1781+
1782+
error = suni_init(dev);
1783+
if (error)
1784+
goto unmap;
1785+
out:
1786+
return error;
1787+
unmap:
1788+
iounmap(base);
1789+
goto out;
17791790
}
17801791

17811792

‎drivers/atm/firestream.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@ static int __devinit fs_init (struct fs_dev *dev)
17101710
/* This bit is documented as "RESERVED" */
17111711
if (isr & ISR_INIT_ERR) {
17121712
printk (KERN_ERR "Error initializing the FS... \n");
1713-
return 1;
1713+
goto unmap;
17141714
}
17151715
if (isr & ISR_INIT) {
17161716
fs_dprintk (FS_DEBUG_INIT, "Ha! Initialized OK!\n");
@@ -1723,7 +1723,7 @@ static int __devinit fs_init (struct fs_dev *dev)
17231723

17241724
if (!to) {
17251725
printk (KERN_ERR "timeout initializing the FS... \n");
1726-
return 1;
1726+
goto unmap;
17271727
}
17281728

17291729
/* XXX fix for fs155 */
@@ -1803,7 +1803,7 @@ static int __devinit fs_init (struct fs_dev *dev)
18031803
if (!dev->atm_vccs) {
18041804
printk (KERN_WARNING "Couldn't allocate memory for VCC buffers. Woops!\n");
18051805
/* XXX Clean up..... */
1806-
return 1;
1806+
goto unmap;
18071807
}
18081808

18091809
dev->tx_inuse = kzalloc (dev->nchannels / 8 /* bits/byte */ , GFP_KERNEL);
@@ -1813,7 +1813,7 @@ static int __devinit fs_init (struct fs_dev *dev)
18131813
if (!dev->tx_inuse) {
18141814
printk (KERN_WARNING "Couldn't allocate memory for tx_inuse bits!\n");
18151815
/* XXX Clean up..... */
1816-
return 1;
1816+
goto unmap;
18171817
}
18181818
/* -- RAS1 : FS155 and 50 differ. Default (0) should be OK for both */
18191819
/* -- RAS2 : FS50 only: Default is OK. */
@@ -1840,7 +1840,7 @@ static int __devinit fs_init (struct fs_dev *dev)
18401840
if (request_irq (dev->irq, fs_irq, IRQF_SHARED, "firestream", dev)) {
18411841
printk (KERN_WARNING "couldn't get irq %d for firestream.\n", pci_dev->irq);
18421842
/* XXX undo all previous stuff... */
1843-
return 1;
1843+
goto unmap;
18441844
}
18451845
fs_dprintk (FS_DEBUG_INIT, "Grabbed irq %d for dev at %p.\n", dev->irq, dev);
18461846

@@ -1890,6 +1890,9 @@ static int __devinit fs_init (struct fs_dev *dev)
18901890

18911891
func_exit ();
18921892
return 0;
1893+
unmap:
1894+
iounmap(dev->base);
1895+
return 1;
18931896
}
18941897

18951898
static int __devinit firestream_init_one (struct pci_dev *pci_dev,
@@ -2012,6 +2015,7 @@ static void __devexit firestream_remove_one (struct pci_dev *pdev)
20122015
for (i=0;i < FS_NR_RX_QUEUES;i++)
20132016
free_queue (dev, &dev->rx_rq[i]);
20142017

2018+
iounmap(dev->base);
20152019
fs_dprintk (FS_DEBUG_ALLOC, "Free fs-dev: %p\n", dev);
20162020
nxtdev = dev->next;
20172021
kfree (dev);

0 commit comments

Comments
 (0)