Commit db0fff74 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by James Bottomley

[PATCH] fix a few missing return value checks in scsi

The attached patch adds a few error checks for the pci dma_mask setting
routines, which after all can fail and thus need their return code
checked.
parent cf255f2f
......@@ -1776,12 +1776,18 @@ ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr,
* our dma mask when doing allocations.
*/
if (ahd->dev_softc != NULL)
ahd_pci_set_dma_mask(ahd->dev_softc, 0xFFFFFFFF);
if (ahd_pci_set_dma_mask(ahd->dev_softc, 0xFFFFFFFF)) {
printk(KERN_WARNING "aic79xx: No suitable DMA available.\n");
return (ENODEV);
}
*vaddr = pci_alloc_consistent(ahd->dev_softc,
dmat->maxsize, &map->bus_addr);
if (ahd->dev_softc != NULL)
ahd_pci_set_dma_mask(ahd->dev_softc,
ahd->platform_data->hw_dma_mask);
if (ahd_pci_set_dma_mask(ahd->dev_softc,
ahd->platform_data->hw_dma_mask)) {
printk(KERN_WARNING "aic79xx: No suitable DMA available.\n");
return (ENODEV);
}
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) */
/*
* At least in 2.2.14, malloc is a slab allocator so all
......
......@@ -1411,12 +1411,18 @@ ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr,
* our dma mask when doing allocations.
*/
if (ahc->dev_softc != NULL)
ahc_pci_set_dma_mask(ahc->dev_softc, 0xFFFFFFFF);
if (ahc_pci_set_dma_mask(ahc->dev_softc, 0xFFFFFFFF)) {
printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
return (ENODEV);
}
*vaddr = pci_alloc_consistent(ahc->dev_softc,
dmat->maxsize, &map->bus_addr);
if (ahc->dev_softc != NULL)
ahc_pci_set_dma_mask(ahc->dev_softc,
ahc->platform_data->hw_dma_mask);
if (ahc_pci_set_dma_mask(ahc->dev_softc,
ahc->platform_data->hw_dma_mask)) {
printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
return (ENODEV);
}
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) */
/*
* At least in 2.2.14, malloc is a slab allocator so all
......
......@@ -166,7 +166,10 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ahc->flags |= AHC_39BIT_ADDRESSING;
ahc->platform_data->hw_dma_mask = mask_39bit;
} else {
ahc_pci_set_dma_mask(pdev, 0xFFFFFFFF);
if (ahc_pci_set_dma_mask(pdev, 0xFFFFFFFF)) {
printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
return (-ENODEV);
}
ahc->platform_data->hw_dma_mask = 0xFFFFFFFF;
}
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment