diff options
author | Dan Carpenter <error27@gmail.com> | 2010-05-07 08:30:41 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-21 16:34:30 (GMT) |
commit | 26e1e8d1d1cfa914b95b5dab001a6ed898872755 (patch) | |
tree | c095b4c89c879f604c5cd9ba2f5968810bd1715a /drivers/char/isicom.c | |
parent | e114474cf5c7fe7ab94dd4f5938ffa51c9af77c4 (diff) | |
download | linux-26e1e8d1d1cfa914b95b5dab001a6ed898872755.tar.xz |
serial: isicomm: handle running out of slots
This patch makes it return -ENODEV if we run out of empty slots in the
probe function. It's unlikely to happen, but it makes the static
checkers happy.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/isicom.c')
-rw-r--r-- | drivers/char/isicom.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index c1ab303..98310e1 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -1573,11 +1573,16 @@ static int __devinit isicom_probe(struct pci_dev *pdev, dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device); /* allot the first empty slot in the array */ - for (index = 0; index < BOARD_COUNT; index++) + for (index = 0; index < BOARD_COUNT; index++) { if (isi_card[index].base == 0) { board = &isi_card[index]; break; } + } + if (index == BOARD_COUNT) { + retval = -ENODEV; + goto err_disable; + } board->index = index; board->base = pci_resource_start(pdev, 3); @@ -1624,6 +1629,7 @@ errunrr: errdec: board->base = 0; card_count--; +err_disable: pci_disable_device(pdev); err: return retval; |