From: Sascha Hauer <s.hauer@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Subject: [PATCH 0/3] dma: make dma_alloc() and dma_zalloc() fallible
Date: Fri, 16 Oct 2026 09:36:52 +0200 [thread overview]
Message-ID: <20261016-dma-alloc-v1-0-31fc7afe3954@pengutronix.de> (raw)
dma_alloc() and dma_zalloc() are implemented with xmemalign() and never
return NULL. That's unlike malloc() and calloc(), and many callers check
for NULL anyway, so they never get to handle an allocation failure.
This series adds dma_xalloc() and dma_xzalloc() for callers that rely on
the allocation to always succeed, switches all callers that don't check
the result over to them, and finally lets dma_alloc() return NULL on
allocation failure.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Sascha Hauer (3):
dma: add dma_xalloc() and dma_xzalloc()
treewide: use dma_xalloc()/dma_xzalloc() where the result isn't checked
dma: let dma_alloc() and dma_zalloc() fail
commands/mmc_extcsd.c | 2 +-
common/block.c | 2 +-
drivers/ata/disk_ata_drive.c | 2 +-
drivers/dma/map.c | 19 ++++++++++++++++++-
drivers/input/usb_kbd.c | 2 +-
drivers/mci/mci-core.c | 10 +++++-----
drivers/net/bcmgenet.c | 2 +-
drivers/net/designware.c | 4 ++--
drivers/net/dsa.c | 6 +++---
drivers/net/e1000/main.c | 2 +-
drivers/net/fsl-fman.c | 2 +-
drivers/net/fsl_enetc.c | 2 +-
drivers/net/macb.c | 2 +-
drivers/net/orion-gbe.c | 2 +-
drivers/net/r8169_main.c | 4 ++--
drivers/net/usb/smsc95xx.c | 2 +-
drivers/usb/core/usb.c | 8 ++++----
drivers/usb/gadget/function/dfu.c | 2 +-
drivers/usb/gadget/function/u_serial.c | 2 +-
drivers/usb/gadget/udc/fsl_udc.c | 2 +-
drivers/usb/storage/transport.c | 6 +++---
drivers/usb/storage/usb.c | 8 ++++----
drivers/video/mipi_dbi.c | 4 ++--
drivers/video/ramfb.c | 2 +-
fs/ext4/ext_barebox.c | 4 ++--
include/dma.h | 12 ++++++++++++
include/linux/slab.h | 6 +++---
include/net.h | 2 +-
28 files changed, 76 insertions(+), 47 deletions(-)
---
base-commit: 7a1f6c08dc94cc8b6a2388d760e9ef793bf64e5b
change-id: 20261016-dma-alloc-d79532c3c096
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
next reply other threads:[~2026-10-16 7:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 7:36 Sascha Hauer [this message]
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
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=20261016-dma-alloc-v1-0-31fc7afe3954@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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