Skip to content
Commit c9bd5e69 authored by Russell King's avatar Russell King
Browse files

DMA-API: sound: fix dma mask handling in a lot of drivers



This code sequence is unsafe in modules:

static u64 mask = DMA_BIT_MASK(something);
...
	if (!dev->dma_mask)
		dev->dma_mask = &mask;

as if a module is reloaded, the mask will be pointing at the original
module's mask address, and this can lead to oopses.  Moreover, they
all follow this with:

	if (!dev->coherent_dma_mask)
		dev->coherent_dma_mask = mask;

where 'mask' is the same value as the statically defined mask, and this
bypasses the architecture's check on whether the DMA mask is possible.

Fix these issues by using the new dma_coerce_coherent_and_mask()
function.

Acked-by: default avatarMark Brown <broonie@linaro.org>
Acked-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent fa6a8d6d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment