git: 0b9bc97342f9 - main - LinuxKPI: add DMA_MAPPING_ERROR
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Sep 2022 19:44:22 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0b9bc97342f98a911985ace5527aef97863dfd23 commit 0b9bc97342f98a911985ace5527aef97863dfd23 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2022-09-23 22:13:19 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2022-09-26 19:42:02 +0000 LinuxKPI: add DMA_MAPPING_ERROR While we deal with 0 returned, some drivers directly use and check for DMA_MAPPING_ERROR. Add the case and check for both in dma_mapping_error(). MFC after: 1 week Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36686 --- sys/compat/linuxkpi/common/include/linux/dma-mapping.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h index 8401006fbf5f..d3d25fcce857 100644 --- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h +++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h @@ -288,11 +288,15 @@ dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, { } +#define DMA_MAPPING_ERROR (~(dma_addr_t)0) + static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { - return (dma_addr == 0); + if (dma_addr == 0 || dma_addr == DMA_MAPPING_ERROR) + return (-ENOMEM); + return (0); } static inline unsigned int dma_set_max_seg_size(struct device *dev,