Skip to content

Commit c0732fe

Browse files
Suraj Guptavinodkoul
authored andcommitted
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. Signed-off-by: Suraj Gupta <suraj.gupta2@amd.com> Fixes: b72db40 ("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>
1 parent 2efd07a commit c0732fe

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/dma/xilinx/xilinx_dma.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
#define XILINX_MCDMA_MAX_CHANS_PER_DEVICE 0x20
132132
#define XILINX_DMA_MAX_CHANS_PER_DEVICE 0x2
133133
#define XILINX_CDMA_MAX_CHANS_PER_DEVICE 0x1
134+
#define XILINX_DMA_DFAULT_ADDRWIDTH 0x20
134135

135136
#define XILINX_DMA_DMAXR_ALL_IRQ_MASK \
136137
(XILINX_DMA_DMASR_FRM_CNT_IRQ | \
@@ -3159,7 +3160,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
31593160
struct device_node *node = pdev->dev.of_node;
31603161
struct xilinx_dma_device *xdev;
31613162
struct device_node *child, *np = pdev->dev.of_node;
3162-
u32 num_frames, addr_width, len_width;
3163+
u32 num_frames, addr_width = XILINX_DMA_DFAULT_ADDRWIDTH, len_width;
31633164
int i, err;
31643165

31653166
/* Allocate and initialize the DMA engine structure */
@@ -3235,7 +3236,9 @@ static int xilinx_dma_probe(struct platform_device *pdev)
32353236

32363237
err = of_property_read_u32(node, "xlnx,addrwidth", &addr_width);
32373238
if (err < 0)
3238-
dev_warn(xdev->dev, "missing xlnx,addrwidth property\n");
3239+
dev_warn(xdev->dev,
3240+
"missing xlnx,addrwidth property, using default value %d\n",
3241+
XILINX_DMA_DFAULT_ADDRWIDTH);
32393242

32403243
if (addr_width > 32)
32413244
xdev->ext_addr = true;

0 commit comments

Comments
 (0)