leds: wm831x-status: fix use-after-free on unbind
[linux/fpc-iii.git] / kernel / dma / dummy.c
blob05607642c888d917224e44211d0072fae7378f0b
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Dummy DMA ops that always fail.
4 */
5 #include <linux/dma-mapping.h>
7 static int dma_dummy_mmap(struct device *dev, struct vm_area_struct *vma,
8 void *cpu_addr, dma_addr_t dma_addr, size_t size,
9 unsigned long attrs)
11 return -ENXIO;
14 static dma_addr_t dma_dummy_map_page(struct device *dev, struct page *page,
15 unsigned long offset, size_t size, enum dma_data_direction dir,
16 unsigned long attrs)
18 return DMA_MAPPING_ERROR;
21 static int dma_dummy_map_sg(struct device *dev, struct scatterlist *sgl,
22 int nelems, enum dma_data_direction dir,
23 unsigned long attrs)
25 return 0;
28 static int dma_dummy_supported(struct device *hwdev, u64 mask)
30 return 0;
33 const struct dma_map_ops dma_dummy_ops = {
34 .mmap = dma_dummy_mmap,
35 .map_page = dma_dummy_map_page,
36 .map_sg = dma_dummy_map_sg,
37 .dma_supported = dma_dummy_supported,
39 EXPORT_SYMBOL(dma_dummy_ops);