Skip to content

dma: make dma_alloc() and dma_zalloc() fallible

Sascha Hauer barebox 1 version Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected] change-id 20261016-dma-alloc-d79532c3c096

Versions newest first

  1. v1 Latest3 patches 4 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3dma: add dma_xalloc() and dma_xzalloc()drivers/dma/map.c include/dma.h+29 -01 reply
2/3treewide: use dma_xalloc()/dma_xzalloc() where the result isn't checkedcommands/mmc_extcsd.c common/block.c drivers/ata/disk_ata_drive.c +23 more+46 -461 reply
3/3dma: let dma_alloc() and dma_zalloc() faildrivers/dma/map.c+1 -11 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchAhmad Fatoum
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] dma: make dma_alloc() and dma_zalloc() fallible

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.

---
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,

Signature · 1 line
Sascha Hauer <[email protected]>