Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Amol Lad and committed by
David S. Miller
78e4be16 de24a193

+24 -9
+15 -4
drivers/atm/eni.c
··· 1738 1738 printk(KERN_ERR KERN_ERR DEV_LABEL "(itf %d): bad " 1739 1739 "magic - expected 0x%x, got 0x%x\n",dev->number, 1740 1740 ENI155_MAGIC,(unsigned) readl(&eprom->magic)); 1741 - return -EINVAL; 1741 + error = -EINVAL; 1742 + goto unmap; 1742 1743 } 1743 1744 } 1744 1745 eni_dev->phy = base+PHY_BASE; ··· 1766 1765 printk(")\n"); 1767 1766 printk(KERN_ERR DEV_LABEL "(itf %d): ERROR - wrong id 0x%x\n", 1768 1767 dev->number,(unsigned) eni_in(MID_RES_ID_MCON)); 1769 - return -EINVAL; 1768 + error = -EINVAL; 1769 + goto unmap; 1770 1770 } 1771 1771 error = eni_dev->asic ? get_esi_asic(dev) : get_esi_fpga(dev,base); 1772 - if (error) return error; 1772 + if (error) 1773 + goto unmap; 1773 1774 for (i = 0; i < ESI_LEN; i++) 1774 1775 printk("%s%02X",i ? "-" : "",dev->esi[i]); 1775 1776 printk(")\n"); 1776 1777 printk(KERN_NOTICE DEV_LABEL "(itf %d): %s,%s\n",dev->number, 1777 1778 eni_in(MID_RES_ID_MCON) & 0x200 ? "ASIC" : "FPGA", 1778 1779 media_name[eni_in(MID_RES_ID_MCON) & DAUGTHER_ID]); 1779 - return suni_init(dev); 1780 + 1781 + error = suni_init(dev); 1782 + if (error) 1783 + goto unmap; 1784 + out: 1785 + return error; 1786 + unmap: 1787 + iounmap(base); 1788 + goto out; 1780 1789 } 1781 1790 1782 1791
+9 -5
drivers/atm/firestream.c
··· 1710 1710 /* This bit is documented as "RESERVED" */ 1711 1711 if (isr & ISR_INIT_ERR) { 1712 1712 printk (KERN_ERR "Error initializing the FS... \n"); 1713 - return 1; 1713 + goto unmap; 1714 1714 } 1715 1715 if (isr & ISR_INIT) { 1716 1716 fs_dprintk (FS_DEBUG_INIT, "Ha! Initialized OK!\n"); ··· 1723 1723 1724 1724 if (!to) { 1725 1725 printk (KERN_ERR "timeout initializing the FS... \n"); 1726 - return 1; 1726 + goto unmap; 1727 1727 } 1728 1728 1729 1729 /* XXX fix for fs155 */ ··· 1803 1803 if (!dev->atm_vccs) { 1804 1804 printk (KERN_WARNING "Couldn't allocate memory for VCC buffers. Woops!\n"); 1805 1805 /* XXX Clean up..... */ 1806 - return 1; 1806 + goto unmap; 1807 1807 } 1808 1808 1809 1809 dev->tx_inuse = kzalloc (dev->nchannels / 8 /* bits/byte */ , GFP_KERNEL); ··· 1813 1813 if (!dev->tx_inuse) { 1814 1814 printk (KERN_WARNING "Couldn't allocate memory for tx_inuse bits!\n"); 1815 1815 /* XXX Clean up..... */ 1816 - return 1; 1816 + goto unmap; 1817 1817 } 1818 1818 /* -- RAS1 : FS155 and 50 differ. Default (0) should be OK for both */ 1819 1819 /* -- RAS2 : FS50 only: Default is OK. */ ··· 1840 1840 if (request_irq (dev->irq, fs_irq, IRQF_SHARED, "firestream", dev)) { 1841 1841 printk (KERN_WARNING "couldn't get irq %d for firestream.\n", pci_dev->irq); 1842 1842 /* XXX undo all previous stuff... */ 1843 - return 1; 1843 + goto unmap; 1844 1844 } 1845 1845 fs_dprintk (FS_DEBUG_INIT, "Grabbed irq %d for dev at %p.\n", dev->irq, dev); 1846 1846 ··· 1890 1890 1891 1891 func_exit (); 1892 1892 return 0; 1893 + unmap: 1894 + iounmap(dev->base); 1895 + return 1; 1893 1896 } 1894 1897 1895 1898 static int __devinit firestream_init_one (struct pci_dev *pci_dev, ··· 2015 2012 for (i=0;i < FS_NR_RX_QUEUES;i++) 2016 2013 free_queue (dev, &dev->rx_rq[i]); 2017 2014 2015 + iounmap(dev->base); 2018 2016 fs_dprintk (FS_DEBUG_ALLOC, "Free fs-dev: %p\n", dev); 2019 2017 nxtdev = dev->next; 2020 2018 kfree (dev);