mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dmaengine: xilinx_dma: Fix uninitialized addr_width when "xlnx,addrwidth" property is missing
@ 2025-09-05  6:48 Suraj Gupta
  2025-09-05  8:50 ` Pandey, Radhey Shyam
  2025-09-05  9:51 ` Folker Schwesinger
  0 siblings, 2 replies; 3+ messages in thread
From: Suraj Gupta @ 2025-09-05  6:48 UTC (permalink / raw)
  To: vkoul, michal.simek, radhey.shyam.pandey
  Cc: dmaengine, linux-arm-kernel, linux-kernel

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")
---
 drivers/dma/xilinx/xilinx_dma.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index fabff602065f..89a8254d9cdc 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -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;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] dmaengine: xilinx_dma: Fix uninitialized addr_width when "xlnx,addrwidth" property is missing
  2025-09-05  6:48 [PATCH] dmaengine: xilinx_dma: Fix uninitialized addr_width when "xlnx,addrwidth" property is missing Suraj Gupta
@ 2025-09-05  8:50 ` Pandey, Radhey Shyam
  2025-09-05  9:51 ` Folker Schwesinger
  1 sibling, 0 replies; 3+ messages in thread
From: Pandey, Radhey Shyam @ 2025-09-05  8:50 UTC (permalink / raw)
  To: Gupta, Suraj, vkoul, Simek, Michal
  Cc: dmaengine, linux-arm-kernel, linux-kernel

[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Suraj Gupta <suraj.gupta2@amd.com>
> Sent: Friday, September 5, 2025 12:18 PM
> To: vkoul@kernel.org; Simek, Michal <michal.simek@amd.com>; Pandey, Radhey
> Shyam <radhey.shyam.pandey@amd.com>
> Cc: dmaengine@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] 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: b72db4005fe4 ("dmaengine: vdma: Add 64 bit addressing support to the
> driver")

Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Thanks!

> ---
>  drivers/dma/xilinx/xilinx_dma.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
> index fabff602065f..89a8254d9cdc 100644
> --- a/drivers/dma/xilinx/xilinx_dma.c
> +++ b/drivers/dma/xilinx/xilinx_dma.c
> @@ -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;
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: xilinx_dma: Fix uninitialized addr_width when "xlnx,addrwidth" property is missing
  2025-09-05  6:48 [PATCH] dmaengine: xilinx_dma: Fix uninitialized addr_width when "xlnx,addrwidth" property is missing Suraj Gupta
  2025-09-05  8:50 ` Pandey, Radhey Shyam
@ 2025-09-05  9:51 ` Folker Schwesinger
  1 sibling, 0 replies; 3+ messages in thread
From: Folker Schwesinger @ 2025-09-05  9:51 UTC (permalink / raw)
  To: Suraj Gupta, vkoul, michal.simek, radhey.shyam.pandey
  Cc: dmaengine, linux-arm-kernel, linux-kernel

On Fri Sep 5, 2025 at 8:48 AM CEST, Suraj Gupta wrote:
> 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: Folker Schwesinger <dev@folker-schwesinger.de>

> ---
>  drivers/dma/xilinx/xilinx_dma.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
> index fabff602065f..89a8254d9cdc 100644
> --- a/drivers/dma/xilinx/xilinx_dma.c
> +++ b/drivers/dma/xilinx/xilinx_dma.c
> @@ -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;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-05 10:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-05  6:48 [PATCH] dmaengine: xilinx_dma: Fix uninitialized addr_width when "xlnx,addrwidth" property is missing Suraj Gupta
2025-09-05  8:50 ` Pandey, Radhey Shyam
2025-09-05  9:51 ` Folker Schwesinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®