diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2007-02-10 04:44:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 13:51:26 -0500 |
commit | 1ed0c0b7306d7c93e83ebe30087a12684b280cdc (patch) | |
tree | a645379fd701d7188d764bc2cbdeed8e137bc0a4 /drivers/char/isicom.c | |
parent | 7edc136ab688f751037a86e8a051151d7962d33f (diff) |
[PATCH] Char: isicom, correct probing/removing
Don't forget to decrease card_count in fail paths and in remove function.
Also null board->base in such cases to point out, that this structure is
unused and thus can be reassigned.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/isicom.c')
-rw-r--r-- | drivers/char/isicom.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 07bc4a5cb1ef..9feb76210534 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -1746,7 +1746,7 @@ end: | |||
1746 | /* | 1746 | /* |
1747 | * Insmod can set static symbols so keep these static | 1747 | * Insmod can set static symbols so keep these static |
1748 | */ | 1748 | */ |
1749 | static int card; | 1749 | static unsigned int card_count; |
1750 | 1750 | ||
1751 | static int __devinit isicom_probe(struct pci_dev *pdev, | 1751 | static int __devinit isicom_probe(struct pci_dev *pdev, |
1752 | const struct pci_device_id *ent) | 1752 | const struct pci_device_id *ent) |
@@ -1756,7 +1756,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev, | |||
1756 | u8 pciirq; | 1756 | u8 pciirq; |
1757 | struct isi_board *board = NULL; | 1757 | struct isi_board *board = NULL; |
1758 | 1758 | ||
1759 | if (card >= BOARD_COUNT) | 1759 | if (card_count >= BOARD_COUNT) |
1760 | goto err; | 1760 | goto err; |
1761 | 1761 | ||
1762 | ioaddr = pci_resource_start(pdev, 3); | 1762 | ioaddr = pci_resource_start(pdev, 3); |
@@ -1774,7 +1774,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev, | |||
1774 | board->index = index; | 1774 | board->index = index; |
1775 | board->base = ioaddr; | 1775 | board->base = ioaddr; |
1776 | board->irq = pciirq; | 1776 | board->irq = pciirq; |
1777 | card++; | 1777 | card_count++; |
1778 | 1778 | ||
1779 | pci_set_drvdata(pdev, board); | 1779 | pci_set_drvdata(pdev, board); |
1780 | 1780 | ||
@@ -1784,7 +1784,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev, | |||
1784 | "will be disabled.\n", board->base, board->base + 15, | 1784 | "will be disabled.\n", board->base, board->base + 15, |
1785 | index + 1); | 1785 | index + 1); |
1786 | retval = -EBUSY; | 1786 | retval = -EBUSY; |
1787 | goto err; | 1787 | goto errdec; |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | retval = request_irq(board->irq, isicom_interrupt, | 1790 | retval = request_irq(board->irq, isicom_interrupt, |
@@ -1813,8 +1813,10 @@ errunri: | |||
1813 | free_irq(board->irq, board); | 1813 | free_irq(board->irq, board); |
1814 | errunrr: | 1814 | errunrr: |
1815 | pci_release_region(pdev, 3); | 1815 | pci_release_region(pdev, 3); |
1816 | err: | 1816 | errdec: |
1817 | board->base = 0; | 1817 | board->base = 0; |
1818 | card_count--; | ||
1819 | err: | ||
1818 | return retval; | 1820 | return retval; |
1819 | } | 1821 | } |
1820 | 1822 | ||
@@ -1828,6 +1830,8 @@ static void __devexit isicom_remove(struct pci_dev *pdev) | |||
1828 | 1830 | ||
1829 | free_irq(board->irq, board); | 1831 | free_irq(board->irq, board); |
1830 | pci_release_region(pdev, 3); | 1832 | pci_release_region(pdev, 3); |
1833 | board->base = 0; | ||
1834 | card_count--; | ||
1831 | } | 1835 | } |
1832 | 1836 | ||
1833 | static int __init isicom_init(void) | 1837 | static int __init isicom_init(void) |
@@ -1835,8 +1839,6 @@ static int __init isicom_init(void) | |||
1835 | int retval, idx, channel; | 1839 | int retval, idx, channel; |
1836 | struct isi_port *port; | 1840 | struct isi_port *port; |
1837 | 1841 | ||
1838 | card = 0; | ||
1839 | |||
1840 | for(idx = 0; idx < BOARD_COUNT; idx++) { | 1842 | for(idx = 0; idx < BOARD_COUNT; idx++) { |
1841 | port = &isi_ports[idx * 16]; | 1843 | port = &isi_ports[idx * 16]; |
1842 | isi_card[idx].ports = port; | 1844 | isi_card[idx].ports = port; |