summaryrefslogtreecommitdiffstats
path: root/drivers/of/device.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-11-09 23:41:58 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2018-11-09 23:41:58 +0100
commitaa4330e15c26c5ef8dd184f515c0655db8c6df3a (patch)
treee9c74e94ccc79da0301a80474debdaabced1799e /drivers/of/device.c
parentMerge tag 'for-linus-20181109' of git://git.kernel.dk/linux-block (diff)
parentof, numa: Validate some distance map rules (diff)
downloadlinux-aa4330e15c26c5ef8dd184f515c0655db8c6df3a.tar.xz
linux-aa4330e15c26c5ef8dd184f515c0655db8c6df3a.zip
Merge tag 'devicetree-fixes-for-4.20-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull Devicetree fixes from Rob Herring: - Add validation of NUMA distance map to prevent crashes with bad map - Fix setting of dma_mask * tag 'devicetree-fixes-for-4.20-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: of, numa: Validate some distance map rules of/device: Really only set bus DMA mask when appropriate
Diffstat (limited to 'drivers/of/device.c')
-rw-r--r--drivers/of/device.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 0f27fad9fe94..5592437bb3d1 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -149,9 +149,11 @@ int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma)
* set by the driver.
*/
mask = DMA_BIT_MASK(ilog2(dma_addr + size - 1) + 1);
- dev->bus_dma_mask = mask;
dev->coherent_dma_mask &= mask;
*dev->dma_mask &= mask;
+ /* ...but only set bus mask if we found valid dma-ranges earlier */
+ if (!ret)
+ dev->bus_dma_mask = mask;
coherent = of_dma_is_coherent(np);
dev_dbg(dev, "device is%sdma coherent\n",