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 <[email protected]> --- 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 <[email protected]>
