• Russell King's avatar
    DMA-API: sound: fix dma mask handling in a lot of drivers · c9bd5e69
    Russell King authored
    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>
    c9bd5e69
atmel-pcm.c 3.28 KB