diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-08-18 10:51:30 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-08-18 10:51:30 -0700 |
commit | 4478976a43c5df8bc70e3a6b0e8ead9d7cff0a3f (patch) | |
tree | 237e1fbcc10735f806781f55f3ac6fb6268dfe12 | |
parent | 04d49f3638d0210de592dd52ad62cfca8b3ed9fe (diff) | |
parent | ee7b1f31200d9f3cc45e1bd22e962bd6b1d4d611 (diff) | |
download | linux-4478976a43c5df8bc70e3a6b0e8ead9d7cff0a3f.tar.bz2 |
Merge tag 'dma-mapping-4.13-3' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping fix from Christoph Hellwig:
"Another dma-mapping regression fix"
* tag 'dma-mapping-4.13-3' of git://git.infradead.org/users/hch/dma-mapping:
of: fix DMA mask generation
-rw-r--r-- | drivers/of/device.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c index 28c38c756f92..e0a28ea341fe 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -89,6 +89,7 @@ int of_dma_configure(struct device *dev, struct device_node *np) bool coherent; unsigned long offset; const struct iommu_ops *iommu; + u64 mask; /* * Set default coherent_dma_mask to 32 bit. Drivers are expected to @@ -134,10 +135,9 @@ int of_dma_configure(struct device *dev, struct device_node *np) * Limit coherent and dma mask based on size and default mask * set by the driver. */ - dev->coherent_dma_mask = min(dev->coherent_dma_mask, - DMA_BIT_MASK(ilog2(dma_addr + size))); - *dev->dma_mask = min((*dev->dma_mask), - DMA_BIT_MASK(ilog2(dma_addr + size))); + mask = DMA_BIT_MASK(ilog2(dma_addr + size - 1) + 1); + dev->coherent_dma_mask &= mask; + *dev->dma_mask &= mask; coherent = of_dma_is_coherent(np); dev_dbg(dev, "device is%sdma coherent\n", |