Commit 1ed0c0b7 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

[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: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7edc136a
...@@ -1746,7 +1746,7 @@ static int __devinit load_firmware(struct pci_dev *pdev, ...@@ -1746,7 +1746,7 @@ static int __devinit load_firmware(struct pci_dev *pdev,
/* /*
* Insmod can set static symbols so keep these static * Insmod can set static symbols so keep these static
*/ */
static int card; static unsigned int card_count;
static int __devinit isicom_probe(struct pci_dev *pdev, static int __devinit isicom_probe(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
...@@ -1756,7 +1756,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev, ...@@ -1756,7 +1756,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
u8 pciirq; u8 pciirq;
struct isi_board *board = NULL; struct isi_board *board = NULL;
if (card >= BOARD_COUNT) if (card_count >= BOARD_COUNT)
goto err; goto err;
ioaddr = pci_resource_start(pdev, 3); ioaddr = pci_resource_start(pdev, 3);
...@@ -1774,7 +1774,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev, ...@@ -1774,7 +1774,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
board->index = index; board->index = index;
board->base = ioaddr; board->base = ioaddr;
board->irq = pciirq; board->irq = pciirq;
card++; card_count++;
pci_set_drvdata(pdev, board); pci_set_drvdata(pdev, board);
...@@ -1784,7 +1784,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev, ...@@ -1784,7 +1784,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
"will be disabled.\n", board->base, board->base + 15, "will be disabled.\n", board->base, board->base + 15,
index + 1); index + 1);
retval = -EBUSY; retval = -EBUSY;
goto err; goto errdec;
} }
retval = request_irq(board->irq, isicom_interrupt, retval = request_irq(board->irq, isicom_interrupt,
...@@ -1813,8 +1813,10 @@ static int __devinit isicom_probe(struct pci_dev *pdev, ...@@ -1813,8 +1813,10 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
free_irq(board->irq, board); free_irq(board->irq, board);
errunrr: errunrr:
pci_release_region(pdev, 3); pci_release_region(pdev, 3);
err: errdec:
board->base = 0; board->base = 0;
card_count--;
err:
return retval; return retval;
} }
...@@ -1828,6 +1830,8 @@ static void __devexit isicom_remove(struct pci_dev *pdev) ...@@ -1828,6 +1830,8 @@ static void __devexit isicom_remove(struct pci_dev *pdev)
free_irq(board->irq, board); free_irq(board->irq, board);
pci_release_region(pdev, 3); pci_release_region(pdev, 3);
board->base = 0;
card_count--;
} }
static int __init isicom_init(void) static int __init isicom_init(void)
...@@ -1835,8 +1839,6 @@ static int __init isicom_init(void) ...@@ -1835,8 +1839,6 @@ static int __init isicom_init(void)
int retval, idx, channel; int retval, idx, channel;
struct isi_port *port; struct isi_port *port;
card = 0;
for(idx = 0; idx < BOARD_COUNT; idx++) { for(idx = 0; idx < BOARD_COUNT; idx++) {
port = &isi_ports[idx * 16]; port = &isi_ports[idx * 16];
isi_card[idx].ports = port; isi_card[idx].ports = port;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment