mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] dma: make dma_alloc() and dma_zalloc() fallible
@ 2026-10-16  7:36 Sascha Hauer
  2026-10-16  7:36 ` [PATCH 1/3] dma: add dma_xalloc() and dma_xzalloc() Sascha Hauer
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sascha Hauer @ 2026-10-16  7:36 UTC (permalink / raw)
  To: BAREBOX

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>




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-16 10:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox