aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-06-10 07:16:54 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-09-17 10:32:38 -0400
commit3e5480791e3b0e239d2cd4e5ecd43a7d2585484b (patch)
treeb7357da0c59892bba369ad27fb46716b8a9f5671 /drivers/net/ethernet
parent4aa806b771d16b810771d86ce23c4c3160888db3 (diff)
DMA-API: net: brocade/bna/bnad.c: fix 32-bit DMA mask handling
The fallback to 32-bit DMA mask is rather odd: if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) && !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) { *using_dac = true; } 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) goto release_regions; } This means we only try and set the coherent DMA mask if we failed to set a 32-bit DMA mask, and only if both fail do we fail the driver. Adjust this so that if either setting fails, we fail the driver - and thereby end up properly setting both the DMA mask and the coherent DMA mask in the fallback case. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/brocade/bna/bnad.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index b78e69e0e52a..45ce6e2214b3 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -3300,17 +3300,12 @@ bnad_pci_init(struct bnad *bnad,
3300 err = pci_request_regions(pdev, BNAD_NAME); 3300 err = pci_request_regions(pdev, BNAD_NAME);
3301 if (err) 3301 if (err)
3302 goto disable_device; 3302 goto disable_device;
3303 if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) && 3303 if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
3304 !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
3305 *using_dac = true; 3304 *using_dac = true;
3306 } else { 3305 } else {
3307 err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); 3306 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
3308 if (err) { 3307 if (err)
3309 err = dma_set_coherent_mask(&pdev->dev, 3308 goto release_regions;
3310 DMA_BIT_MASK(32));
3311 if (err)
3312 goto release_regions;
3313 }
3314 *using_dac = false; 3309 *using_dac = false;
3315 } 3310 }
3316 pci_set_master(pdev); 3311 pci_set_master(pdev);