public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: tegra210-adma: Add error logging on failure paths
@ 2026-03-18  7:39 Sheetal
  2026-03-18  9:45 ` Vinod Koul
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sheetal @ 2026-03-18  7:39 UTC (permalink / raw)
  To: Jon Hunter, Vinod Koul, Thierry Reding
  Cc: Laxman Dewangan, Frank Li, Mohan Kumar, dmaengine, linux-tegra,
	linux-kernel, Sheetal

Add dev_err/dev_err_probe logging across failure paths to improve
debuggability of DMA errors during runtime and probe.

Signed-off-by: Sheetal <sheetal@nvidia.com>
---
 drivers/dma/tegra210-adma.c | 48 +++++++++++++++++++++++++++++--------
 1 file changed, 38 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
index 14e0c408ed1e..a50cd52fec18 100644
--- a/drivers/dma/tegra210-adma.c
+++ b/drivers/dma/tegra210-adma.c
@@ -335,8 +335,16 @@ static int tegra_adma_request_alloc(struct tegra_adma_chan *tdc,
 	struct tegra_adma *tdma = tdc->tdma;
 	unsigned int sreq_index = tdc->sreq_index;
 
-	if (tdc->sreq_reserved)
-		return tdc->sreq_dir == direction ? 0 : -EINVAL;
+	if (tdc->sreq_reserved) {
+		if (tdc->sreq_dir != direction) {
+			dev_err(tdma->dev,
+				"DMA request direction mismatch: reserved=%s, requested=%s\n",
+				dmaengine_get_direction_text(tdc->sreq_dir),
+				dmaengine_get_direction_text(direction));
+			return -EINVAL;
+		}
+		return 0;
+	}
 
 	if (sreq_index > tdma->cdata->ch_req_max) {
 		dev_err(tdma->dev, "invalid DMA request\n");
@@ -665,8 +673,11 @@ static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc,
 	const struct tegra_adma_chip_data *cdata = tdc->tdma->cdata;
 	unsigned int burst_size, adma_dir, fifo_size_shift;
 
-	if (desc->num_periods > ADMA_CH_CONFIG_MAX_BUFS)
+	if (desc->num_periods > ADMA_CH_CONFIG_MAX_BUFS) {
+		dev_err(tdc2dev(tdc), "invalid DMA periods %u (max %u)\n",
+			desc->num_periods, ADMA_CH_CONFIG_MAX_BUFS);
 		return -EINVAL;
+	}
 
 	switch (direction) {
 	case DMA_MEM_TO_DEV:
@@ -1047,38 +1058,50 @@ static int tegra_adma_probe(struct platform_device *pdev)
 	res_page = platform_get_resource_byname(pdev, IORESOURCE_MEM, "page");
 	if (res_page) {
 		tdma->ch_base_addr = devm_ioremap_resource(&pdev->dev, res_page);
-		if (IS_ERR(tdma->ch_base_addr))
+		if (IS_ERR(tdma->ch_base_addr)) {
+			dev_err(&pdev->dev, "failed to map page resource\n");
 			return PTR_ERR(tdma->ch_base_addr);
+		}
 
 		res_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "global");
 		if (res_base) {
 			resource_size_t page_offset, page_no;
 			unsigned int ch_base_offset;
 
-			if (res_page->start < res_base->start)
+			if (res_page->start < res_base->start) {
+				dev_err(&pdev->dev, "invalid page/global resource order\n");
 				return -EINVAL;
+			}
+
 			page_offset = res_page->start - res_base->start;
 			ch_base_offset = cdata->ch_base_offset;
 			if (!ch_base_offset)
 				return -EINVAL;
 
 			page_no = div_u64(page_offset, ch_base_offset);
-			if (!page_no || page_no > INT_MAX)
+			if (!page_no || page_no > INT_MAX) {
+				dev_err(&pdev->dev, "invalid page number %llu\n", page_no);
 				return -EINVAL;
+			}
 
 			tdma->ch_page_no = page_no - 1;
 			tdma->base_addr = devm_ioremap_resource(&pdev->dev, res_base);
-			if (IS_ERR(tdma->base_addr))
+			if (IS_ERR(tdma->base_addr)) {
+				dev_err(&pdev->dev, "failed to map global resource\n");
 				return PTR_ERR(tdma->base_addr);
+			}
 		}
 	} else {
 		/* If no 'page' property found, then reg DT binding would be legacy */
 		res_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 		if (res_base) {
 			tdma->base_addr = devm_ioremap_resource(&pdev->dev, res_base);
-			if (IS_ERR(tdma->base_addr))
+			if (IS_ERR(tdma->base_addr)) {
+				dev_err(&pdev->dev, "failed to map base resource\n");
 				return PTR_ERR(tdma->base_addr);
+			}
 		} else {
+			dev_err(&pdev->dev, "failed to map mem resource\n");
 			return -ENODEV;
 		}
 
@@ -1130,6 +1153,7 @@ static int tegra_adma_probe(struct platform_device *pdev)
 		tdc->irq = of_irq_get(pdev->dev.of_node, i);
 		if (tdc->irq <= 0) {
 			ret = tdc->irq ?: -ENXIO;
+			dev_err_probe(&pdev->dev, ret, "failed to get IRQ for channel %d\n", i);
 			goto irq_dispose;
 		}
 
@@ -1141,12 +1165,16 @@ static int tegra_adma_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 
 	ret = pm_runtime_resume_and_get(&pdev->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_err(&pdev->dev, "runtime PM resume failed: %d\n", ret);
 		goto rpm_disable;
+	}
 
 	ret = tegra_adma_init(tdma);
-	if (ret)
+	if (ret) {
+		dev_err(&pdev->dev, "failed to initialize ADMA: %d\n", ret);
 		goto rpm_put;
+	}
 
 	dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask);
 	dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask);
-- 
2.17.1


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

* Re: [PATCH] dmaengine: tegra210-adma: Add error logging on failure paths
  2026-03-18  7:39 [PATCH] dmaengine: tegra210-adma: Add error logging on failure paths Sheetal
@ 2026-03-18  9:45 ` Vinod Koul
  2026-03-18 23:42 ` kernel test robot
  2026-03-18 23:42 ` kernel test robot
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2026-03-18  9:45 UTC (permalink / raw)
  To: Sheetal
  Cc: Jon Hunter, Thierry Reding, Laxman Dewangan, Frank Li,
	Mohan Kumar, dmaengine, linux-tegra, linux-kernel

On 18-03-26, 07:39, Sheetal wrote:
> Add dev_err/dev_err_probe logging across failure paths to improve
> debuggability of DMA errors during runtime and probe.

This fails to build. Please enable W=1 and send

drivers/dma/tegra210-adma.c: In function ‘tegra_adma_set_xfer_params’:
drivers/dma/tegra210-adma.c:677:39: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Werror=format=]
  677 |                 dev_err(tdc2dev(tdc), "invalid DMA periods %u (max %u)\n",


> 
> Signed-off-by: Sheetal <sheetal@nvidia.com>
> ---
>  drivers/dma/tegra210-adma.c | 48 +++++++++++++++++++++++++++++--------
>  1 file changed, 38 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
> index 14e0c408ed1e..a50cd52fec18 100644
> --- a/drivers/dma/tegra210-adma.c
> +++ b/drivers/dma/tegra210-adma.c
> @@ -335,8 +335,16 @@ static int tegra_adma_request_alloc(struct tegra_adma_chan *tdc,
>  	struct tegra_adma *tdma = tdc->tdma;
>  	unsigned int sreq_index = tdc->sreq_index;
>  
> -	if (tdc->sreq_reserved)
> -		return tdc->sreq_dir == direction ? 0 : -EINVAL;
> +	if (tdc->sreq_reserved) {
> +		if (tdc->sreq_dir != direction) {
> +			dev_err(tdma->dev,
> +				"DMA request direction mismatch: reserved=%s, requested=%s\n",
> +				dmaengine_get_direction_text(tdc->sreq_dir),
> +				dmaengine_get_direction_text(direction));
> +			return -EINVAL;
> +		}
> +		return 0;
> +	}
>  
>  	if (sreq_index > tdma->cdata->ch_req_max) {
>  		dev_err(tdma->dev, "invalid DMA request\n");
> @@ -665,8 +673,11 @@ static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc,
>  	const struct tegra_adma_chip_data *cdata = tdc->tdma->cdata;
>  	unsigned int burst_size, adma_dir, fifo_size_shift;
>  
> -	if (desc->num_periods > ADMA_CH_CONFIG_MAX_BUFS)
> +	if (desc->num_periods > ADMA_CH_CONFIG_MAX_BUFS) {
> +		dev_err(tdc2dev(tdc), "invalid DMA periods %u (max %u)\n",
> +			desc->num_periods, ADMA_CH_CONFIG_MAX_BUFS);
>  		return -EINVAL;
> +	}
>  
>  	switch (direction) {
>  	case DMA_MEM_TO_DEV:
> @@ -1047,38 +1058,50 @@ static int tegra_adma_probe(struct platform_device *pdev)
>  	res_page = platform_get_resource_byname(pdev, IORESOURCE_MEM, "page");
>  	if (res_page) {
>  		tdma->ch_base_addr = devm_ioremap_resource(&pdev->dev, res_page);
> -		if (IS_ERR(tdma->ch_base_addr))
> +		if (IS_ERR(tdma->ch_base_addr)) {
> +			dev_err(&pdev->dev, "failed to map page resource\n");
>  			return PTR_ERR(tdma->ch_base_addr);
> +		}
>  
>  		res_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "global");
>  		if (res_base) {
>  			resource_size_t page_offset, page_no;
>  			unsigned int ch_base_offset;
>  
> -			if (res_page->start < res_base->start)
> +			if (res_page->start < res_base->start) {
> +				dev_err(&pdev->dev, "invalid page/global resource order\n");
>  				return -EINVAL;
> +			}
> +
>  			page_offset = res_page->start - res_base->start;
>  			ch_base_offset = cdata->ch_base_offset;
>  			if (!ch_base_offset)
>  				return -EINVAL;
>  
>  			page_no = div_u64(page_offset, ch_base_offset);
> -			if (!page_no || page_no > INT_MAX)
> +			if (!page_no || page_no > INT_MAX) {
> +				dev_err(&pdev->dev, "invalid page number %llu\n", page_no);
>  				return -EINVAL;
> +			}
>  
>  			tdma->ch_page_no = page_no - 1;
>  			tdma->base_addr = devm_ioremap_resource(&pdev->dev, res_base);
> -			if (IS_ERR(tdma->base_addr))
> +			if (IS_ERR(tdma->base_addr)) {
> +				dev_err(&pdev->dev, "failed to map global resource\n");
>  				return PTR_ERR(tdma->base_addr);
> +			}
>  		}
>  	} else {
>  		/* If no 'page' property found, then reg DT binding would be legacy */
>  		res_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  		if (res_base) {
>  			tdma->base_addr = devm_ioremap_resource(&pdev->dev, res_base);
> -			if (IS_ERR(tdma->base_addr))
> +			if (IS_ERR(tdma->base_addr)) {
> +				dev_err(&pdev->dev, "failed to map base resource\n");
>  				return PTR_ERR(tdma->base_addr);
> +			}
>  		} else {
> +			dev_err(&pdev->dev, "failed to map mem resource\n");
>  			return -ENODEV;
>  		}
>  
> @@ -1130,6 +1153,7 @@ static int tegra_adma_probe(struct platform_device *pdev)
>  		tdc->irq = of_irq_get(pdev->dev.of_node, i);
>  		if (tdc->irq <= 0) {
>  			ret = tdc->irq ?: -ENXIO;
> +			dev_err_probe(&pdev->dev, ret, "failed to get IRQ for channel %d\n", i);
>  			goto irq_dispose;
>  		}
>  
> @@ -1141,12 +1165,16 @@ static int tegra_adma_probe(struct platform_device *pdev)
>  	pm_runtime_enable(&pdev->dev);
>  
>  	ret = pm_runtime_resume_and_get(&pdev->dev);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "runtime PM resume failed: %d\n", ret);
>  		goto rpm_disable;
> +	}
>  
>  	ret = tegra_adma_init(tdma);
> -	if (ret)
> +	if (ret) {
> +		dev_err(&pdev->dev, "failed to initialize ADMA: %d\n", ret);
>  		goto rpm_put;
> +	}
>  
>  	dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask);
>  	dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask);
> -- 
> 2.17.1

-- 
~Vinod

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

* Re: [PATCH] dmaengine: tegra210-adma: Add error logging on failure paths
  2026-03-18  7:39 [PATCH] dmaengine: tegra210-adma: Add error logging on failure paths Sheetal
  2026-03-18  9:45 ` Vinod Koul
@ 2026-03-18 23:42 ` kernel test robot
  2026-03-18 23:42 ` kernel test robot
  2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-03-18 23:42 UTC (permalink / raw)
  To: Sheetal, Jon Hunter, Vinod Koul, Thierry Reding
  Cc: oe-kbuild-all, Laxman Dewangan, Frank Li, Mohan Kumar, dmaengine,
	linux-tegra, linux-kernel, Sheetal

Hi Sheetal,

kernel test robot noticed the following build warnings:

[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on linus/master v7.0-rc4 next-20260318]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sheetal/dmaengine-tegra210-adma-Add-error-logging-on-failure-paths/20260318-214221
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next
patch link:    https://lore.kernel.org/r/20260318073922.1760132-1-sheetal%40nvidia.com
patch subject: [PATCH] dmaengine: tegra210-adma: Add error logging on failure paths
config: x86_64-buildonly-randconfig-003-20260319 (https://download.01.org/0day-ci/archive/20260319/202603190726.ahyQblsp-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260319/202603190726.ahyQblsp-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603190726.ahyQblsp-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
                    from include/linux/dmaengine.h:8,
                    from include/linux/of_dma.h:14,
                    from drivers/dma/tegra210-adma.c:12:
   drivers/dma/tegra210-adma.c: In function 'tegra_adma_set_xfer_params':
>> drivers/dma/tegra210-adma.c:677:39: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     677 |                 dev_err(tdc2dev(tdc), "invalid DMA periods %u (max %u)\n",
         |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ^~~
   include/linux/dev_printk.h:154:56: note: in expansion of macro 'dev_fmt'
     154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                        ^~~~~~~
   drivers/dma/tegra210-adma.c:677:17: note: in expansion of macro 'dev_err'
     677 |                 dev_err(tdc2dev(tdc), "invalid DMA periods %u (max %u)\n",
         |                 ^~~~~~~
   drivers/dma/tegra210-adma.c:677:61: note: format string is defined here
     677 |                 dev_err(tdc2dev(tdc), "invalid DMA periods %u (max %u)\n",
         |                                                            ~^
         |                                                             |
         |                                                             unsigned int
         |                                                            %lu


vim +677 drivers/dma/tegra210-adma.c

   666	
   667	static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc,
   668					      struct tegra_adma_desc *desc,
   669					      dma_addr_t buf_addr,
   670					      enum dma_transfer_direction direction)
   671	{
   672		struct tegra_adma_chan_regs *ch_regs = &desc->ch_regs;
   673		const struct tegra_adma_chip_data *cdata = tdc->tdma->cdata;
   674		unsigned int burst_size, adma_dir, fifo_size_shift;
   675	
   676		if (desc->num_periods > ADMA_CH_CONFIG_MAX_BUFS) {
 > 677			dev_err(tdc2dev(tdc), "invalid DMA periods %u (max %u)\n",
   678				desc->num_periods, ADMA_CH_CONFIG_MAX_BUFS);
   679			return -EINVAL;
   680		}
   681	
   682		switch (direction) {
   683		case DMA_MEM_TO_DEV:
   684			fifo_size_shift = ADMA_CH_TX_FIFO_SIZE_SHIFT;
   685			adma_dir = ADMA_CH_CTRL_DIR_MEM2AHUB;
   686			burst_size = tdc->sconfig.dst_maxburst;
   687			ch_regs->config = ADMA_CH_CONFIG_SRC_BUF(desc->num_periods - 1);
   688			ch_regs->ctrl = ADMA_CH_REG_FIELD_VAL(tdc->sreq_index,
   689							      cdata->ch_req_mask,
   690							      cdata->ch_req_tx_shift);
   691			ch_regs->src_addr = buf_addr;
   692			break;
   693	
   694		case DMA_DEV_TO_MEM:
   695			fifo_size_shift = ADMA_CH_RX_FIFO_SIZE_SHIFT;
   696			adma_dir = ADMA_CH_CTRL_DIR_AHUB2MEM;
   697			burst_size = tdc->sconfig.src_maxburst;
   698			ch_regs->config = ADMA_CH_CONFIG_TRG_BUF(desc->num_periods - 1);
   699			ch_regs->ctrl = ADMA_CH_REG_FIELD_VAL(tdc->sreq_index,
   700							      cdata->ch_req_mask,
   701							      cdata->ch_req_rx_shift);
   702			ch_regs->trg_addr = buf_addr;
   703			break;
   704	
   705		default:
   706			dev_err(tdc2dev(tdc), "DMA direction is not supported\n");
   707			return -EINVAL;
   708		}
   709	
   710		ch_regs->ctrl |= ADMA_CH_CTRL_DIR(adma_dir, cdata->ch_dir_mask,
   711				cdata->ch_dir_shift) |
   712				 ADMA_CH_CTRL_MODE_CONTINUOUS(cdata->ch_mode_shift) |
   713				 ADMA_CH_CTRL_FLOWCTRL_EN;
   714		ch_regs->config |= cdata->adma_get_burst_config(burst_size);
   715	
   716		if (cdata->global_ch_config_base)
   717			ch_regs->global_config |= cdata->ch_config;
   718		else
   719			ch_regs->config |= cdata->ch_config;
   720	
   721		/*
   722		 * 'sreq_index' represents the current ADMAIF channel number and as per
   723		 * HW recommendation its FIFO size should match with the corresponding
   724		 * ADMA channel.
   725		 *
   726		 * ADMA FIFO size is set as per below (based on default ADMAIF channel
   727		 * FIFO sizes):
   728		 *    fifo_size = 0x2 (sreq_index > sreq_index_offset)
   729		 *    fifo_size = 0x3 (sreq_index <= sreq_index_offset)
   730		 *
   731		 */
   732		if (tdc->sreq_index > cdata->sreq_index_offset)
   733			ch_regs->fifo_ctrl =
   734				ADMA_CH_REG_FIELD_VAL(2, cdata->ch_fifo_size_mask,
   735						      fifo_size_shift);
   736		else
   737			ch_regs->fifo_ctrl =
   738				ADMA_CH_REG_FIELD_VAL(3, cdata->ch_fifo_size_mask,
   739						      fifo_size_shift);
   740	
   741		ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;
   742	
   743		return tegra_adma_request_alloc(tdc, direction);
   744	}
   745	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH] dmaengine: tegra210-adma: Add error logging on failure paths
  2026-03-18  7:39 [PATCH] dmaengine: tegra210-adma: Add error logging on failure paths Sheetal
  2026-03-18  9:45 ` Vinod Koul
  2026-03-18 23:42 ` kernel test robot
@ 2026-03-18 23:42 ` kernel test robot
  2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-03-18 23:42 UTC (permalink / raw)
  To: Sheetal, Jon Hunter, Vinod Koul, Thierry Reding
  Cc: llvm, oe-kbuild-all, Laxman Dewangan, Frank Li, Mohan Kumar,
	dmaengine, linux-tegra, linux-kernel, Sheetal

Hi Sheetal,

kernel test robot noticed the following build warnings:

[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on linus/master v7.0-rc4 next-20260318]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sheetal/dmaengine-tegra210-adma-Add-error-logging-on-failure-paths/20260318-214221
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next
patch link:    https://lore.kernel.org/r/20260318073922.1760132-1-sheetal%40nvidia.com
patch subject: [PATCH] dmaengine: tegra210-adma: Add error logging on failure paths
config: i386-buildonly-randconfig-001-20260319 (https://download.01.org/0day-ci/archive/20260319/202603190728.xcKzTcOu-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260319/202603190728.xcKzTcOu-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603190728.xcKzTcOu-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/dma/tegra210-adma.c:1083:55: warning: format specifies type 'unsigned long long' but the argument has type 'resource_size_t' (aka 'unsigned int') [-Wformat]
    1083 |                                 dev_err(&pdev->dev, "invalid page number %llu\n", page_no);
         |                                                                          ~~~~     ^~~~~~~
         |                                                                          %u
   include/linux/dev_printk.h:154:65: note: expanded from macro 'dev_err'
     154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                                ~~~     ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ~~~    ^~~~~~~~~~~
   1 warning generated.


vim +1083 drivers/dma/tegra210-adma.c

  1033	
  1034	static int tegra_adma_probe(struct platform_device *pdev)
  1035	{
  1036		const struct tegra_adma_chip_data *cdata;
  1037		struct tegra_adma *tdma;
  1038		struct resource *res_page, *res_base;
  1039		int ret, i;
  1040	
  1041		cdata = of_device_get_match_data(&pdev->dev);
  1042		if (!cdata) {
  1043			dev_err(&pdev->dev, "device match data not found\n");
  1044			return -ENODEV;
  1045		}
  1046	
  1047		tdma = devm_kzalloc(&pdev->dev,
  1048				    struct_size(tdma, channels, cdata->nr_channels),
  1049				    GFP_KERNEL);
  1050		if (!tdma)
  1051			return -ENOMEM;
  1052	
  1053		tdma->dev = &pdev->dev;
  1054		tdma->cdata = cdata;
  1055		tdma->nr_channels = cdata->nr_channels;
  1056		platform_set_drvdata(pdev, tdma);
  1057	
  1058		res_page = platform_get_resource_byname(pdev, IORESOURCE_MEM, "page");
  1059		if (res_page) {
  1060			tdma->ch_base_addr = devm_ioremap_resource(&pdev->dev, res_page);
  1061			if (IS_ERR(tdma->ch_base_addr)) {
  1062				dev_err(&pdev->dev, "failed to map page resource\n");
  1063				return PTR_ERR(tdma->ch_base_addr);
  1064			}
  1065	
  1066			res_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "global");
  1067			if (res_base) {
  1068				resource_size_t page_offset, page_no;
  1069				unsigned int ch_base_offset;
  1070	
  1071				if (res_page->start < res_base->start) {
  1072					dev_err(&pdev->dev, "invalid page/global resource order\n");
  1073					return -EINVAL;
  1074				}
  1075	
  1076				page_offset = res_page->start - res_base->start;
  1077				ch_base_offset = cdata->ch_base_offset;
  1078				if (!ch_base_offset)
  1079					return -EINVAL;
  1080	
  1081				page_no = div_u64(page_offset, ch_base_offset);
  1082				if (!page_no || page_no > INT_MAX) {
> 1083					dev_err(&pdev->dev, "invalid page number %llu\n", page_no);
  1084					return -EINVAL;
  1085				}
  1086	
  1087				tdma->ch_page_no = page_no - 1;
  1088				tdma->base_addr = devm_ioremap_resource(&pdev->dev, res_base);
  1089				if (IS_ERR(tdma->base_addr)) {
  1090					dev_err(&pdev->dev, "failed to map global resource\n");
  1091					return PTR_ERR(tdma->base_addr);
  1092				}
  1093			}
  1094		} else {
  1095			/* If no 'page' property found, then reg DT binding would be legacy */
  1096			res_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  1097			if (res_base) {
  1098				tdma->base_addr = devm_ioremap_resource(&pdev->dev, res_base);
  1099				if (IS_ERR(tdma->base_addr)) {
  1100					dev_err(&pdev->dev, "failed to map base resource\n");
  1101					return PTR_ERR(tdma->base_addr);
  1102				}
  1103			} else {
  1104				dev_err(&pdev->dev, "failed to map mem resource\n");
  1105				return -ENODEV;
  1106			}
  1107	
  1108			tdma->ch_base_addr = tdma->base_addr + cdata->ch_base_offset;
  1109		}
  1110	
  1111		tdma->ahub_clk = devm_clk_get(&pdev->dev, "d_audio");
  1112		if (IS_ERR(tdma->ahub_clk)) {
  1113			dev_err(&pdev->dev, "Error: Missing ahub controller clock\n");
  1114			return PTR_ERR(tdma->ahub_clk);
  1115		}
  1116	
  1117		tdma->dma_chan_mask = devm_kzalloc(&pdev->dev,
  1118						   BITS_TO_LONGS(tdma->nr_channels) * sizeof(unsigned long),
  1119						   GFP_KERNEL);
  1120		if (!tdma->dma_chan_mask)
  1121			return -ENOMEM;
  1122	
  1123		/* Enable all channels by default */
  1124		bitmap_fill(tdma->dma_chan_mask, tdma->nr_channels);
  1125	
  1126		ret = of_property_read_u32_array(pdev->dev.of_node, "dma-channel-mask",
  1127						 (u32 *)tdma->dma_chan_mask,
  1128						 BITS_TO_U32(tdma->nr_channels));
  1129		if (ret < 0 && (ret != -EINVAL)) {
  1130			dev_err(&pdev->dev, "dma-channel-mask is not complete.\n");
  1131			return ret;
  1132		}
  1133	
  1134		INIT_LIST_HEAD(&tdma->dma_dev.channels);
  1135		for (i = 0; i < tdma->nr_channels; i++) {
  1136			struct tegra_adma_chan *tdc = &tdma->channels[i];
  1137	
  1138			/* skip for reserved channels */
  1139			if (!test_bit(i, tdma->dma_chan_mask))
  1140				continue;
  1141	
  1142			tdc->chan_addr = tdma->ch_base_addr + (cdata->ch_reg_size * i);
  1143	
  1144			if (tdma->base_addr) {
  1145				if (cdata->global_ch_fifo_base)
  1146					tdc->global_ch_fifo_offset = cdata->global_ch_fifo_base + (4 * i);
  1147	
  1148				if (cdata->global_ch_config_base)
  1149					tdc->global_ch_config_offset =
  1150						cdata->global_ch_config_base + (4 * i);
  1151			}
  1152	
  1153			tdc->irq = of_irq_get(pdev->dev.of_node, i);
  1154			if (tdc->irq <= 0) {
  1155				ret = tdc->irq ?: -ENXIO;
  1156				dev_err_probe(&pdev->dev, ret, "failed to get IRQ for channel %d\n", i);
  1157				goto irq_dispose;
  1158			}
  1159	
  1160			vchan_init(&tdc->vc, &tdma->dma_dev);
  1161			tdc->vc.desc_free = tegra_adma_desc_free;
  1162			tdc->tdma = tdma;
  1163		}
  1164	
  1165		pm_runtime_enable(&pdev->dev);
  1166	
  1167		ret = pm_runtime_resume_and_get(&pdev->dev);
  1168		if (ret < 0) {
  1169			dev_err(&pdev->dev, "runtime PM resume failed: %d\n", ret);
  1170			goto rpm_disable;
  1171		}
  1172	
  1173		ret = tegra_adma_init(tdma);
  1174		if (ret) {
  1175			dev_err(&pdev->dev, "failed to initialize ADMA: %d\n", ret);
  1176			goto rpm_put;
  1177		}
  1178	
  1179		dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask);
  1180		dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask);
  1181		dma_cap_set(DMA_CYCLIC, tdma->dma_dev.cap_mask);
  1182	
  1183		tdma->dma_dev.dev = &pdev->dev;
  1184		tdma->dma_dev.device_alloc_chan_resources =
  1185						tegra_adma_alloc_chan_resources;
  1186		tdma->dma_dev.device_free_chan_resources =
  1187						tegra_adma_free_chan_resources;
  1188		tdma->dma_dev.device_issue_pending = tegra_adma_issue_pending;
  1189		tdma->dma_dev.device_prep_dma_cyclic = tegra_adma_prep_dma_cyclic;
  1190		tdma->dma_dev.device_config = tegra_adma_slave_config;
  1191		tdma->dma_dev.device_tx_status = tegra_adma_tx_status;
  1192		tdma->dma_dev.device_terminate_all = tegra_adma_terminate_all;
  1193		tdma->dma_dev.device_synchronize = tegra_adma_synchronize;
  1194		tdma->dma_dev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
  1195		tdma->dma_dev.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
  1196		tdma->dma_dev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
  1197		tdma->dma_dev.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT;
  1198		tdma->dma_dev.device_pause = tegra_adma_pause;
  1199		tdma->dma_dev.device_resume = tegra_adma_resume;
  1200	
  1201		ret = dma_async_device_register(&tdma->dma_dev);
  1202		if (ret < 0) {
  1203			dev_err(&pdev->dev, "ADMA registration failed: %d\n", ret);
  1204			goto rpm_put;
  1205		}
  1206	
  1207		ret = of_dma_controller_register(pdev->dev.of_node,
  1208						 tegra_dma_of_xlate, tdma);
  1209		if (ret < 0) {
  1210			dev_err(&pdev->dev, "ADMA OF registration failed %d\n", ret);
  1211			goto dma_remove;
  1212		}
  1213	
  1214		pm_runtime_put(&pdev->dev);
  1215	
  1216		dev_info(&pdev->dev, "Tegra210 ADMA driver registered %d channels\n",
  1217			 tdma->nr_channels);
  1218	
  1219		return 0;
  1220	
  1221	dma_remove:
  1222		dma_async_device_unregister(&tdma->dma_dev);
  1223	rpm_put:
  1224		pm_runtime_put_sync(&pdev->dev);
  1225	rpm_disable:
  1226		pm_runtime_disable(&pdev->dev);
  1227	irq_dispose:
  1228		while (--i >= 0)
  1229			irq_dispose_mapping(tdma->channels[i].irq);
  1230	
  1231		return ret;
  1232	}
  1233	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2026-03-18 23:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18  7:39 [PATCH] dmaengine: tegra210-adma: Add error logging on failure paths Sheetal
2026-03-18  9:45 ` Vinod Koul
2026-03-18 23:42 ` kernel test robot
2026-03-18 23:42 ` kernel test robot

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