diff options
author | Jeremy Higdon <jeremy@sgi.com> | 2005-12-15 02:10:35 +0100 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2005-12-15 02:10:35 +0100 |
commit | deb5e5c0c68e59b1bf9ede66da9e6a89f6557595 (patch) | |
tree | 49aaf885da2f0db842cc19d29c8744f6f3a35827 /drivers/ide | |
parent | acd9b7b4e08a3f0f48afa922d8e371414cf2d3b2 (diff) | |
download | op-kernel-dev-deb5e5c0c68e59b1bf9ede66da9e6a89f6557595.zip op-kernel-dev-deb5e5c0c68e59b1bf9ede66da9e6a89f6557595.tar.gz |
[PATCH] sgiioc4: check for no hwifs available
Add a check to the sgiioc4 driver for the case where all available
ide_hwifs structures are in use.
Signed-off-by: Jeremy Higdon <jeremy@sgi.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/pci/sgiioc4.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index af526b6..4ee597d 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c @@ -622,12 +622,18 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t * d) ide_hwif_t *hwif; int h; + /* + * Find an empty HWIF; if none available, return -ENOMEM. + */ for (h = 0; h < MAX_HWIFS; ++h) { hwif = &ide_hwifs[h]; - /* Find an empty HWIF */ if (hwif->chipset == ide_unknown) break; } + if (h == MAX_HWIFS) { + printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n", d->name); + return -ENOMEM; + } /* Get the CmdBlk and CtrlBlk Base Registers */ base = pci_resource_start(dev, 0) + IOC4_CMD_OFFSET; |