git: a55a8bfe5d13 - stable/13 - LinuxKPI: add DMA_MAPPING_ERROR
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 29 Nov 2023 16:37:48 UTC
The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a55a8bfe5d13108c806759a8a85bcb9add610848 commit a55a8bfe5d13108c806759a8a85bcb9add610848 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2022-09-23 22:13:19 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2023-11-29 16:36:03 +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(). (cherry picked from commit 0b9bc97342f98a911985ace5527aef97863dfd23) --- 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 7b12e927addf..3b98e03ad6a4 100644 --- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h +++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h @@ -286,11 +286,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,