[PATCH v7 02/10] dmaengine: arm-dma350: Check DMA mask setup errors

Frank Li Frank.li at oss.nxp.com
Fri Nov 20 09:29:35 PST 2026


On Tue, Nov 17, 2026 at 05:43:27PM +0800, Jelly Jia wrote:
> The controller's address width is used to configure its DMA mask. If
> dma_set_mask_and_coherent() fails, continuing probe leaves the device
> registered with an unsupported DMA address configuration.
>
> Check the return value and fail probe before allocating DMA resources.
>
> Fixes: 5d099706449d ("dmaengine: Add Arm DMA-350 driver")
> Signed-off-by: Jelly Jia <Jelly.Jia at cixtech.com>
> ---

Reviewed-by: Frank Li <Frank.Li at nxp.com

>>  drivers/dma/arm-dma350.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/arm-dma350.c b/drivers/dma/arm-dma350.c
> index fdc4cd224579..d9f1d2976034 100644
> --- a/drivers/dma/arm-dma350.c
> +++ b/drivers/dma/arm-dma350.c
> @@ -553,7 +553,9 @@ static int d350_probe(struct platform_device *pdev)
>  	dw = 1 << FIELD_GET(DMA_CFG_DATA_WIDTH, reg);
>  	aw = FIELD_GET(DMA_CFG_ADDR_WIDTH, reg) + 1;
>
> -	dma_set_mask_and_coherent(dev, DMA_BIT_MASK(aw));
> +	ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(aw));
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to set DMA mask\n");
>  	coherent = device_get_dma_attr(dev) == DEV_DMA_COHERENT;
>
>  	dmac = devm_kzalloc(dev, struct_size(dmac, channels, nchan), GFP_KERNEL);
> --
> 2.54.0
>



More information about the linux-arm-kernel mailing list