mirror of https://github.com/thesofproject/sof.git
dma: check if sg exists before cache operations
Checks if dma_sg_elem_array buffer is allocated before performing cache writeback or invalidation. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
parent
76587ac98a
commit
1820be6f7e
|
@ -330,15 +330,18 @@ void dma_sg_free(struct dma_sg_elem_array *ea);
|
|||
|
||||
static inline void dma_sg_cache_wb_inv(struct dma_sg_elem_array *ea)
|
||||
{
|
||||
dcache_writeback_invalidate_region(ea->elems,
|
||||
ea->count *
|
||||
sizeof(struct dma_sg_elem));
|
||||
if (ea->elems)
|
||||
dcache_writeback_invalidate_region(ea->elems,
|
||||
ea->count *
|
||||
sizeof(struct dma_sg_elem));
|
||||
}
|
||||
|
||||
static inline void dma_sg_cache_inv(struct dma_sg_elem_array *ea)
|
||||
{
|
||||
dcache_invalidate_region(ea->elems,
|
||||
ea->count * sizeof(struct dma_sg_elem));
|
||||
if (ea->elems)
|
||||
dcache_invalidate_region(ea->elems,
|
||||
ea->count *
|
||||
sizeof(struct dma_sg_elem));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue