diff options
author | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2013-05-28 16:46:46 -0400 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2013-05-28 16:46:46 -0400 |
commit | cf9f123b38345b2c2777e642eb9bb561f4b7de91 (patch) | |
tree | fafec4fa1735722cc79766b7f55864252c671aad /drivers/block/nvme-core.c | |
parent | cf90bc4830b858487fe4b9b9ecd0031e23ca3e83 (diff) |
NVMe: Use dma_set_mask() correctly
In some circumstances setting a 64-bit DMA mask can fail, as explained
in Documentation/DMA-API-HOWTO.txt. Use the recommended code sequence
to set a 32-bit DMA mask if setting a 64-bit DMA mask fails.
Reported-by: Chayan Biswas <Chayan.Biswas@sandisk.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block/nvme-core.c')
-rw-r--r-- | drivers/block/nvme-core.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 84937089d5db..a57d3bcec803 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -1927,8 +1927,14 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1927 | INIT_LIST_HEAD(&dev->namespaces); | 1927 | INIT_LIST_HEAD(&dev->namespaces); |
1928 | dev->pci_dev = pdev; | 1928 | dev->pci_dev = pdev; |
1929 | pci_set_drvdata(pdev, dev); | 1929 | pci_set_drvdata(pdev, dev); |
1930 | dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); | 1930 | |
1931 | dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); | 1931 | if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) |
1932 | dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); | ||
1933 | else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) | ||
1934 | dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | ||
1935 | else | ||
1936 | goto disable; | ||
1937 | |||
1932 | result = nvme_set_instance(dev); | 1938 | result = nvme_set_instance(dev); |
1933 | if (result) | 1939 | if (result) |
1934 | goto disable; | 1940 | goto disable; |