diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:59 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:59 -0400 |
commit | 8a69580e1ea9516caada5eed202afd39546e9809 (patch) | |
tree | fb300fb7d67e09470a2654811baaa7832fec2fae /drivers/ide/pci/sgiioc4.c | |
parent | 18de10170df31d34b342612f1c896a16a52f0a5c (diff) |
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/sgiioc4.c')
-rw-r--r-- | drivers/ide/pci/sgiioc4.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 440f43a86ad3..42eef19a18f1 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) | |||
603 | struct ide_host *host; | 603 | struct ide_host *host; |
604 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 604 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
605 | struct ide_port_info d = sgiioc4_port_info; | 605 | struct ide_port_info d = sgiioc4_port_info; |
606 | int rc; | ||
606 | 607 | ||
607 | /* Get the CmdBlk and CtrlBlk Base Registers */ | 608 | /* Get the CmdBlk and CtrlBlk Base Registers */ |
608 | bar0 = pci_resource_start(dev, 0); | 609 | bar0 = pci_resource_start(dev, 0); |
@@ -638,17 +639,22 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
638 | writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); | 639 | writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); |
639 | 640 | ||
640 | host = ide_host_alloc(&d, hws); | 641 | host = ide_host_alloc(&d, hws); |
641 | if (host == NULL) | 642 | if (host == NULL) { |
643 | rc = -ENOMEM; | ||
642 | goto err; | 644 | goto err; |
645 | } | ||
643 | 646 | ||
644 | if (ide_host_register(host, &d, hws)) | 647 | rc = ide_host_register(host, &d, hws); |
645 | return -EIO; | 648 | if (rc) |
649 | goto err_free; | ||
646 | 650 | ||
647 | return 0; | 651 | return 0; |
652 | err_free: | ||
653 | ide_host_free(host); | ||
648 | err: | 654 | err: |
649 | release_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE); | 655 | release_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE); |
650 | iounmap(virt_base); | 656 | iounmap(virt_base); |
651 | return -ENOMEM; | 657 | return rc; |
652 | } | 658 | } |
653 | 659 | ||
654 | static unsigned int __devinit | 660 | static unsigned int __devinit |