diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-08-20 16:42:56 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-08-20 16:42:56 -0400 |
commit | f7b0d2df2f6fd9abdf47b4a1965dcaa2870e35df (patch) | |
tree | 9aad5394bba6ae8acb6769a789f31ef78c0b9028 | |
parent | adcd33d41bfea8fb6870cf1f7e7ed2e5f7323fc1 (diff) |
cs5530: 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 <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/pci/cs5530.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index acaf71fd4c09..e5949b1d3fb0 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cs5530.c Version 0.73 Mar 10 2007 | 2 | * linux/drivers/ide/pci/cs5530.c Version 0.74 Jul 28 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2000 Mark Lord <mlord@pobox.com> | 5 | * Copyright (C) 2000 Mark Lord <mlord@pobox.com> |
@@ -207,6 +207,9 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch | |||
207 | struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; | 207 | struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; |
208 | unsigned long flags; | 208 | unsigned long flags; |
209 | 209 | ||
210 | if (pci_resource_start(dev, 4) == 0) | ||
211 | return -EFAULT; | ||
212 | |||
210 | dev = NULL; | 213 | dev = NULL; |
211 | while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) { | 214 | while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) { |
212 | switch (dev->device) { | 215 | switch (dev->device) { |
@@ -325,6 +328,9 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif) | |||
325 | /* needs autotuning later */ | 328 | /* needs autotuning later */ |
326 | } | 329 | } |
327 | 330 | ||
331 | if (hwif->dma_base == 0) | ||
332 | return; | ||
333 | |||
328 | hwif->atapi_dma = 1; | 334 | hwif->atapi_dma = 1; |
329 | hwif->ultra_mask = 0x07; | 335 | hwif->ultra_mask = 0x07; |
330 | hwif->mwdma_mask = 0x07; | 336 | hwif->mwdma_mask = 0x07; |