[PATCH 3/3] dma: let dma_alloc() and dma_zalloc() fail
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Oct 16 03:35:45 PDT 2026
On 10/16/26 9:36 AM, Sascha Hauer wrote:
> 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 <s.hauer at pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> 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);
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list