diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-13 11:47:52 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-13 11:47:52 -0400 |
commit | b9d9e61abb85ecf4e4aa55328b21eac17840a3fb (patch) | |
tree | 2f021637a5e90ea01e3ad0aad24d39552ae89916 /drivers/ide/pci | |
parent | 7bda292d12795877ade9a7ccc044a7bb0ea8e8b4 (diff) |
sgiioc4: add missing ->dma_base check
If ->dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks
shouldn't be initialized or bad things will happen.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r-- | drivers/ide/pci/sgiioc4.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 26352626c0e8..85ffaaa39b1b 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
@@ -587,8 +587,6 @@ static void __devinit | |||
587 | ide_init_sgiioc4(ide_hwif_t * hwif) | 587 | ide_init_sgiioc4(ide_hwif_t * hwif) |
588 | { | 588 | { |
589 | hwif->mmio = 1; | 589 | hwif->mmio = 1; |
590 | hwif->atapi_dma = 1; | ||
591 | hwif->mwdma_mask = 0x04; | ||
592 | hwif->pio_mask = 0x00; | 590 | hwif->pio_mask = 0x00; |
593 | hwif->set_pio_mode = NULL; /* Sets timing for PIO mode */ | 591 | hwif->set_pio_mode = NULL; /* Sets timing for PIO mode */ |
594 | hwif->set_dma_mode = &sgiioc4_set_dma_mode; | 592 | hwif->set_dma_mode = &sgiioc4_set_dma_mode; |
@@ -602,6 +600,14 @@ ide_init_sgiioc4(ide_hwif_t * hwif) | |||
602 | hwif->quirkproc = NULL; | 600 | hwif->quirkproc = NULL; |
603 | hwif->busproc = NULL; | 601 | hwif->busproc = NULL; |
604 | 602 | ||
603 | hwif->INB = &sgiioc4_INB; | ||
604 | |||
605 | if (hwif->dma_base == 0) | ||
606 | return; | ||
607 | |||
608 | hwif->atapi_dma = 1; | ||
609 | hwif->mwdma_mask = 0x04; | ||
610 | |||
605 | hwif->dma_setup = &sgiioc4_ide_dma_setup; | 611 | hwif->dma_setup = &sgiioc4_ide_dma_setup; |
606 | hwif->dma_start = &sgiioc4_ide_dma_start; | 612 | hwif->dma_start = &sgiioc4_ide_dma_start; |
607 | hwif->ide_dma_end = &sgiioc4_ide_dma_end; | 613 | hwif->ide_dma_end = &sgiioc4_ide_dma_end; |
@@ -613,8 +619,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif) | |||
613 | hwif->dma_host_off = &sgiioc4_dma_host_off; | 619 | hwif->dma_host_off = &sgiioc4_dma_host_off; |
614 | hwif->dma_lost_irq = &sgiioc4_dma_lost_irq; | 620 | hwif->dma_lost_irq = &sgiioc4_dma_lost_irq; |
615 | hwif->dma_timeout = &ide_dma_timeout; | 621 | hwif->dma_timeout = &ide_dma_timeout; |
616 | |||
617 | hwif->INB = &sgiioc4_INB; | ||
618 | } | 622 | } |
619 | 623 | ||
620 | static int __devinit | 624 | static int __devinit |
@@ -684,8 +688,6 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
684 | /* Initializing chipset IRQ Registers */ | 688 | /* Initializing chipset IRQ Registers */ |
685 | writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); | 689 | writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); |
686 | 690 | ||
687 | ide_init_sgiioc4(hwif); | ||
688 | |||
689 | hwif->autodma = 0; | 691 | hwif->autodma = 0; |
690 | 692 | ||
691 | if (dma_base && ide_dma_sgiioc4(hwif, dma_base) == 0) { | 693 | if (dma_base && ide_dma_sgiioc4(hwif, dma_base) == 0) { |
@@ -695,6 +697,8 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
695 | printk(KERN_INFO "%s: %s Bus-Master DMA disabled\n", | 697 | printk(KERN_INFO "%s: %s Bus-Master DMA disabled\n", |
696 | hwif->name, DRV_NAME); | 698 | hwif->name, DRV_NAME); |
697 | 699 | ||
700 | ide_init_sgiioc4(hwif); | ||
701 | |||
698 | if (probe_hwif_init(hwif)) | 702 | if (probe_hwif_init(hwif)) |
699 | return -EIO; | 703 | return -EIO; |
700 | 704 | ||