summaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 19:55:59 +0200
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 19:55:59 +0200
commit8a69580e1ea9516caada5eed202afd39546e9809 (patch)
treefb300fb7d67e09470a2654811baaa7832fec2fae /drivers/ide/pci
parent18de10170df31d34b342612f1c896a16a52f0a5c (diff)
downloadop-kernel-dev-8a69580e1ea9516caada5eed202afd39546e9809.zip
op-kernel-dev-8a69580e1ea9516caada5eed202afd39546e9809.tar.gz
ide: add ide_host_free() helper (take 2)
* Add ide_host_free() helper and convert ide_host_remove() to use it. * Fix handling of ide_host_register() failure in ide_host_add(), icside.c, ide-generic.c, falconide.c and sgiioc4.c. While at it: * Fix handling of ide_host_alloc_all() failure in ide-generic.c. * Fix handling of ide_host_alloc() failure in falconide.c (also return the correct error value if no device is found). v2: * falconide build fix. (From Stephen Rothwell) Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r--drivers/ide/pci/sgiioc4.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 440f43a..42eef19 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -603,6 +603,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
struct ide_host *host;
hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
struct ide_port_info d = sgiioc4_port_info;
+ int rc;
/* Get the CmdBlk and CtrlBlk Base Registers */
bar0 = pci_resource_start(dev, 0);
@@ -638,17 +639,22 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4));
host = ide_host_alloc(&d, hws);
- if (host == NULL)
+ if (host == NULL) {
+ rc = -ENOMEM;
goto err;
+ }
- if (ide_host_register(host, &d, hws))
- return -EIO;
+ rc = ide_host_register(host, &d, hws);
+ if (rc)
+ goto err_free;
return 0;
+err_free:
+ ide_host_free(host);
err:
release_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE);
iounmap(virt_base);
- return -ENOMEM;
+ return rc;
}
static unsigned int __devinit
OpenPOWER on IntegriCloud