Now that all callers relying on the allocation to always succeed use
dma_xalloc() and dma_xzalloc(), implement dma_alloc() with memalign()
instead of xmemalign(), so it returns NULL on allocation failure like
malloc() does, and the callers checking for NULL get to handle it.

dma_zalloc() is implemented with dma_alloc() and already checks for
NULL, and the !CONFIG_HAS_DMA versions are implemented with malloc()
and calloc() already, so they need no changes.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Sascha Hauer <[email protected]>
---
 drivers/dma/map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/map.c b/drivers/dma/map.c
index 806439a05d..7a476ed044 100644
--- a/drivers/dma/map.c
+++ b/drivers/dma/map.c
@@ -5,7 +5,7 @@
 
 void *dma_alloc(size_t size)
 {
-       return xmemalign(DMA_ALIGNMENT, ALIGN(size, DMA_ALIGNMENT));
+       return memalign(DMA_ALIGNMENT, ALIGN(size, DMA_ALIGNMENT));
 }
 EXPORT_SYMBOL(dma_alloc);
 

-- 
2.47.3


Reply via email to