Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=01cc643ae3c7de35b63989b7b65e3ef3132e48e4
Commit:     01cc643ae3c7de35b63989b7b65e3ef3132e48e4
Parent:     f7b0d2df2f6fd9abdf47b4a1965dcaa2870e35df
Author:     Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
AuthorDate: Mon Aug 20 22:42:56 2007 +0200
Committer:  Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
CommitDate: Mon Aug 20 22:42:56 2007 +0200

    pdc202xx_new: 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.
    
    Also this host driver requires valid PCI BAR4 for normal operation so
    check it in ->init_chipset and fail initialization if not set.
    
    Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/pci/pdc202xx_new.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 8a66a28..f6db2f3 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -378,6 +378,9 @@ static unsigned int __devinit init_chipset_pdcnew(struct 
pci_dev *dev, const cha
        int f, r;
        u8 pll_ctl0, pll_ctl1;
 
+       if (dma_base == 0)
+               return -EFAULT;
+
 #ifdef CONFIG_PPC_PMAC
        apple_kiwi_init(dev);
 #endif
@@ -494,15 +497,18 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t 
*hwif)
        hwif->speedproc = &pdcnew_tune_chipset;
        hwif->resetproc = &pdcnew_reset;
 
+       hwif->err_stops_fifo = 1;
+
        hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
 
+       if (hwif->dma_base == 0)
+               return;
+
        hwif->atapi_dma  = 1;
 
        hwif->ultra_mask = hwif->cds->udma_mask;
        hwif->mwdma_mask = 0x07;
 
-       hwif->err_stops_fifo = 1;
-
        hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate;
 
        if (hwif->cbl != ATA_CBL_PATA40_SHORT)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to