]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dmaengine: xilinx_dma: Fix uninitialized addr_width when "xlnx,addrwidth" property...
authorSuraj Gupta <suraj.gupta2@amd.com>
Tue, 21 Oct 2025 18:30:06 +0000 (00:00 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jan 2026 10:18:40 +0000 (11:18 +0100)
[ Upstream commit c0732fe78728718c853ef8e7af5bbb05262acbd1 ]

When device tree lacks optional "xlnx,addrwidth" property, the addr_width
variable remained uninitialized with garbage values, causing incorrect
DMA mask configuration and subsequent probe failure. The fix ensures a
fallback to the default 32-bit address width when this property is missing.

Signed-off-by: Suraj Gupta <suraj.gupta2@amd.com>
Fixes: b72db4005fe4 ("dmaengine: vdma: Add 64 bit addressing support to the driver")
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Reviewed-by: Folker Schwesinger <dev@folker-schwesinger.de>
Link: https://patch.msgid.link/20251021183006.3434495-1-suraj.gupta2@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/dma/xilinx/xilinx_dma.c

index aa59b62cd83fb7800020d4753cde6bdce97eeb59..3ad37e9b924a742653fd9b0bb5004d8fdb9fc23d 100644 (file)
 #define XILINX_MCDMA_MAX_CHANS_PER_DEVICE      0x20
 #define XILINX_DMA_MAX_CHANS_PER_DEVICE                0x2
 #define XILINX_CDMA_MAX_CHANS_PER_DEVICE       0x1
+#define XILINX_DMA_DFAULT_ADDRWIDTH            0x20
 
 #define XILINX_DMA_DMAXR_ALL_IRQ_MASK  \
                (XILINX_DMA_DMASR_FRM_CNT_IRQ | \
@@ -3063,7 +3064,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
        struct device_node *node = pdev->dev.of_node;
        struct xilinx_dma_device *xdev;
        struct device_node *child, *np = pdev->dev.of_node;
-       u32 num_frames, addr_width, len_width;
+       u32 num_frames, addr_width = XILINX_DMA_DFAULT_ADDRWIDTH, len_width;
        int i, err;
 
        /* Allocate and initialize the DMA engine structure */
@@ -3137,7 +3138,9 @@ static int xilinx_dma_probe(struct platform_device *pdev)
 
        err = of_property_read_u32(node, "xlnx,addrwidth", &addr_width);
        if (err < 0)
-               dev_warn(xdev->dev, "missing xlnx,addrwidth property\n");
+               dev_warn(xdev->dev,
+                        "missing xlnx,addrwidth property, using default value %d\n",
+                        XILINX_DMA_DFAULT_ADDRWIDTH);
 
        if (addr_width > 32)
                xdev->ext_addr = true;