diff options
-rw-r--r-- | drivers/ata/libata-sff.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 8af18ad1ca7f..d211db6b35a2 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -566,7 +566,7 @@ static int ata_pci_init_bmdma(struct ata_host *host) | |||
566 | } | 566 | } |
567 | host->iomap = pcim_iomap_table(pdev); | 567 | host->iomap = pcim_iomap_table(pdev); |
568 | 568 | ||
569 | for (i = 0; i < 2; i++) { | 569 | for (i = 0; i < host->n_ports; i++) { |
570 | struct ata_port *ap = host->ports[i]; | 570 | struct ata_port *ap = host->ports[i]; |
571 | void __iomem *bmdma = host->iomap[4] + 8 * i; | 571 | void __iomem *bmdma = host->iomap[4] + 8 * i; |
572 | 572 | ||
@@ -875,7 +875,7 @@ static int ata_request_legacy_irqs(struct ata_host *host, | |||
875 | legacy_dr = devres_find(host->dev, ata_legacy_release, NULL, NULL); | 875 | legacy_dr = devres_find(host->dev, ata_legacy_release, NULL, NULL); |
876 | BUG_ON(!legacy_dr); | 876 | BUG_ON(!legacy_dr); |
877 | 877 | ||
878 | for (i = 0; i < 2; i++) { | 878 | for (i = 0; i < host->n_ports; i++) { |
879 | unsigned int irq; | 879 | unsigned int irq; |
880 | 880 | ||
881 | /* FIXME: ATA_*_IRQ() should take generic device not pci_dev */ | 881 | /* FIXME: ATA_*_IRQ() should take generic device not pci_dev */ |
@@ -963,10 +963,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
963 | BUG_ON(n_ports < 1 || n_ports > 2); | 963 | BUG_ON(n_ports < 1 || n_ports > 2); |
964 | 964 | ||
965 | port[0] = port_info[0]; | 965 | port[0] = port_info[0]; |
966 | if (n_ports > 1) | 966 | port[1] = (n_ports > 1) ? port_info[1] : NULL; |
967 | port[1] = port_info[1]; | ||
968 | else | ||
969 | port[1] = port[0]; | ||
970 | 967 | ||
971 | /* FIXME: Really for ATA it isn't safe because the device may be | 968 | /* FIXME: Really for ATA it isn't safe because the device may be |
972 | multi-purpose and we want to leave it alone if it was already | 969 | multi-purpose and we want to leave it alone if it was already |
@@ -1001,7 +998,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
1001 | } | 998 | } |
1002 | 999 | ||
1003 | /* alloc and init host */ | 1000 | /* alloc and init host */ |
1004 | host = ata_host_alloc_pinfo(dev, port, 2); | 1001 | host = ata_host_alloc_pinfo(dev, port, n_ports); |
1005 | if (!host) { | 1002 | if (!host) { |
1006 | dev_printk(KERN_ERR, &pdev->dev, | 1003 | dev_printk(KERN_ERR, &pdev->dev, |
1007 | "failed to allocate ATA host\n"); | 1004 | "failed to allocate ATA host\n"); |