mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH 3/3] dma: let dma_alloc() and dma_zalloc() fail
Date: Fri, 16 Oct 2026 12:35:45 +0200	[thread overview]
Message-ID: <3e3fdac1-99af-4924-8a92-9925081444d6@pengutronix.de> (raw)
In-Reply-To: <20261016-dma-alloc-v1-3-31fc7afe3954@pengutronix.de>



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@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@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 |




      reply	other threads:[~2026-10-16 10:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  7:36 [PATCH 0/3] dma: make dma_alloc() and dma_zalloc() fallible Sascha Hauer
2026-10-16  7:36 ` [PATCH 1/3] dma: add dma_xalloc() and dma_xzalloc() Sascha Hauer
2026-10-16 10:31   ` Ahmad Fatoum
2026-10-16  7:36 ` [PATCH 2/3] treewide: use dma_xalloc()/dma_xzalloc() where the result isn't checked Sascha Hauer
2026-10-16 10:35   ` Ahmad Fatoum
2026-10-16  7:36 ` [PATCH 3/3] dma: let dma_alloc() and dma_zalloc() fail Sascha Hauer
2026-10-16 10:35   ` Ahmad Fatoum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e3fdac1-99af-4924-8a92-9925081444d6@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox