Skip to contentSkip to conversation

dmaengine: xilinx_dma: Fix uninitialized addr_width when "xlnx,addrwidth" property is missing

PATCH RESEND Applied Suraj Gupta 2 participants 3 messages Oct 21, 2025 – Dec 16, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 dmaengine: xilinx_dma: Fix uninitialized addr_width when "xlnx,addrwidth" property is missing

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.

Fixes b72db4005fe4 ("dmaengine: vdma: Add 64 bit addressing support to the driver")
---
 drivers/dma/xilinx/xilinx_dma.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/dma/xilinx/xilinx_dma.c +5 -2
index fabff602065f..89a8254d9cdc 100644
@@ -131,6 +131,7 @@
 #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 | \
@@ -3159,7 +3160,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 */
@@ -3235,7 +3236,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;
Signature · 1 line
2.25.1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Gentle ping.

Regards,
Suraj

Quoted 64 lines

-----Original Message-----
From: Suraj Gupta <[email protected]>
Sent: Wednesday, October 22, 2025 12:00 AM
To: [email protected]; Pandey, Radhey Shyam <[email protected]>; Simek, Michal <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: [PATCH RESEND] dmaengine: xilinx_dma: Fix uninitialized addr_width when "xlnx,addrwidth" property is missing

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

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.

Fixes b72db4005fe4 ("dmaengine: vdma: Add 64 bit addressing support to the

driver")

---
 drivers/dma/xilinx/xilinx_dma.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/dma/xilinx/xilinx_dma.c +1 -0
index fabff602065f..89a8254d9cdc 100644
@@ -131,6 +131,7 @@
 #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 | \ @@ -3159,7 +3160,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;
drivers/dma/xilinx/xilinx_dma.c +6 -3
-       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 */ @@ -3235,7
+3236,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;
--

2.25.1

maintainer Applied
#2 lore raw
In reply to Suraj Gupta
Quoted 6 lines · Suraj Gupta

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.

Applied, thanks!

[1/1] dmaengine: xilinx_dma: Fix uninitialized addr_width when "xlnx,addrwidth" property is missing

      commit: c0732fe78728718c853ef8e7af5bbb05262acbd1

Best regards,

Signature · 1 line
~Vinod