aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-06-10 07:24:50 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-09-21 16:00:59 -0400
commitdc4ff9bb7534ebd153f8441ec0e9190964ad8944 (patch)
tree10b9a63e3a55df74f3f55e884c6dac3f4487f0c1 /drivers/net
parent718a39eb587e038f7ded076afcfd8d709879139f (diff)
DMA-API: net: intel/igb: fix 32-bit DMA mask handling
The fallback to 32-bit DMA mask is rather odd: err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); if (!err) { err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); if (!err) pci_using_dac = 1; } else { err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); if (err) { err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); if (err) { dev_err(&pdev->dev, "No usable DMA configuration, aborting\n"); goto err_dma; } } } This means we only set the coherent DMA mask in the fallback path if the DMA mask set failed, which is silly. This fixes it to set the coherent DMA mask only if dma_set_mask() succeeded, and to error out if either fails. Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 8cf44f2a8ccd..7579383c584d 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2034,21 +2034,15 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2034 return err; 2034 return err;
2035 2035
2036 pci_using_dac = 0; 2036 pci_using_dac = 0;
2037 err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); 2037 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
2038 if (!err) { 2038 if (!err) {
2039 err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); 2039 pci_using_dac = 1;
2040 if (!err)
2041 pci_using_dac = 1;
2042 } else { 2040 } else {
2043 err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); 2041 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
2044 if (err) { 2042 if (err) {
2045 err = dma_set_coherent_mask(&pdev->dev, 2043 dev_err(&pdev->dev,
2046 DMA_BIT_MASK(32)); 2044 "No usable DMA configuration, aborting\n");
2047 if (err) { 2045 goto err_dma;
2048 dev_err(&pdev->dev,
2049 "No usable DMA configuration, aborting\n");
2050 goto err_dma;
2051 }
2052 } 2046 }
2053 } 2047 }
2054 2048