mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
* [PATCH] dmaengine: amlogic: Fix regmap error check issue
@ 2026-10-16  3:00 Xianwei Zhao via B4 Relay
  2026-10-16  3:08 ` sashiko-bot
  0 siblings, 1 reply; 3+ messages in thread
From: Xianwei Zhao via B4 Relay @ 2026-10-16  3:00 UTC (permalink / raw)
  To: Vinod Koul, Frank Li
  Cc: linux-amlogic, dmaengine, linux-kernel, kernel test robot,
	Dan Carpenter, Xianwei Zhao

From: Xianwei Zhao <xianwei.zhao@amlogic.com>

The func devm_regmap_init_mmio() only returns an error pointer on failure,
Use IS_ERR() instead to make the intent clearer. And Fix the following
compilation issue at the same time.

Smatch warnings:
drivers/dma/amlogic-dma.c:636 aml_dma_probe() warn: passing zero to 'PTR_ERR'

Fixes: b84b5197e344 ("dmaengine: amlogic: Add general DMA driver for A9")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202610080953.C5TYlCaA-lkp@intel.com/
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
Fix regmap error check issue.
---
 drivers/dma/amlogic-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/amlogic-dma.c b/drivers/dma/amlogic-dma.c
index 78ee2337ae71..684121d13fca 100644
--- a/drivers/dma/amlogic-dma.c
+++ b/drivers/dma/amlogic-dma.c
@@ -632,7 +632,7 @@ static int aml_dma_probe(struct platform_device *pdev)
 
 	aml_dma->regmap = devm_regmap_init_mmio(&pdev->dev, aml_dma->base,
 						&aml_regmap_config);
-	if (IS_ERR_OR_NULL(aml_dma->regmap))
+	if (IS_ERR(aml_dma->regmap))
 		return PTR_ERR(aml_dma->regmap);
 
 	aml_dma->clk = devm_clk_get_enabled(&pdev->dev, NULL);

---
base-commit: 42c31fec1ca76b8b5f7759def122d418dff2cd4b
change-id: 20261016-fix-a9-dma-complier-178b6e667983

Best regards,
-- 
Xianwei Zhao <xianwei.zhao@amlogic.com>



_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] dmaengine: amlogic: Fix regmap error check issue
  2026-10-16  3:00 [PATCH] dmaengine: amlogic: Fix regmap error check issue Xianwei Zhao via B4 Relay
@ 2026-10-16  3:08 ` sashiko-bot
  2026-10-16  6:41   ` Xianwei Zhao
  0 siblings, 1 reply; 3+ messages in thread
From: sashiko-bot @ 2026-10-16  3:08 UTC (permalink / raw)
  To: Xianwei Zhao; +Cc: linux-amlogic, dmaengine, vkoul, Frank.Li, neil.armstrong

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dmaengine: amlogic: free_wq leaked on error paths in aml_dma_probe()
--

commit 84261163c6f208aa12834ec242da34b3d805e7ad
Author: Xianwei Zhao <xianwei.zhao@amlogic.com>

dmaengine: amlogic: Fix regmap error check issue

This commit changes the error check for devm_regmap_init_mmio() to use
IS_ERR() instead of IS_ERR_OR_NULL(). This resolves a Smatch warning about
passing zero to PTR_ERR().

Closes: https://lore.kernel.org/r/202610080953.C5TYlCaA-lkp@intel.com/

> diff --git a/drivers/dma/amlogic-dma.c b/drivers/dma/amlogic-dma.c
> index 78ee2337ae712..684121d13fcab 100644
> --- a/drivers/dma/amlogic-dma.c
> +++ b/drivers/dma/amlogic-dma.c
> @@ -632,7 +632,7 @@ static int aml_dma_probe(struct platform_device *pdev)
>  
>  	aml_dma->regmap = devm_regmap_init_mmio(&pdev->dev, aml_dma->base,
>  						&aml_regmap_config);
> -	if (IS_ERR_OR_NULL(aml_dma->regmap))
> +	if (IS_ERR(aml_dma->regmap))
>  		return PTR_ERR(aml_dma->regmap);

[Severity: Medium]
Does this code leak the free_wq workqueue on this error path?

aml_dma->free_wq is allocated earlier in aml_dma_probe() using
alloc_ordered_workqueue(), which isn't managed by devres:

drivers/dma/amlogic-dma.c:aml_dma_probe() {
    ...
	aml_dma->free_wq = alloc_ordered_workqueue("aml_dma_free", 0);
	if (!aml_dma->free_wq)
		return -ENOMEM;
    ...
}

If devm_regmap_init_mmio() fails and we return directly here, there is
no cleanup for the allocated workqueue.

>  
>  	aml_dma->clk = devm_clk_get_enabled(&pdev->dev, NULL);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261016-fix-a9-dma-complier-v1-1-024421d5b3c8@amlogic.com?part=1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] dmaengine: amlogic: Fix regmap error check issue
  2026-10-16  3:08 ` sashiko-bot
@ 2026-10-16  6:41   ` Xianwei Zhao
  0 siblings, 0 replies; 3+ messages in thread
From: Xianwei Zhao @ 2026-10-16  6:41 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: linux-amlogic, dmaengine, vkoul, Frank.Li, neil.armstrong

Hi,

On 2026/10/16 11:08, sashiko-bot@kernel.org wrote:
> [ EXTERNAL EMAIL ]
> 
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] dmaengine: amlogic: free_wq leaked on error paths in aml_dma_probe()
> --
> 
> commit 84261163c6f208aa12834ec242da34b3d805e7ad
> Author: Xianwei Zhao <xianwei.zhao@amlogic.com>
> 
> dmaengine: amlogic: Fix regmap error check issue
> 
> This commit changes the error check for devm_regmap_init_mmio() to use
> IS_ERR() instead of IS_ERR_OR_NULL(). This resolves a Smatch warning about
> passing zero to PTR_ERR().
> 
> Closes: https://lore.kernel.org/r/202610080953.C5TYlCaA-lkp@intel.com/
> 
>> diff --git a/drivers/dma/amlogic-dma.c b/drivers/dma/amlogic-dma.c
>> index 78ee2337ae712..684121d13fcab 100644
>> --- a/drivers/dma/amlogic-dma.c
>> +++ b/drivers/dma/amlogic-dma.c
>> @@ -632,7 +632,7 @@ static int aml_dma_probe(struct platform_device *pdev)
>>
>>        aml_dma->regmap = devm_regmap_init_mmio(&pdev->dev, aml_dma->base,
>>                                                &aml_regmap_config);
>> -     if (IS_ERR_OR_NULL(aml_dma->regmap))
>> +     if (IS_ERR(aml_dma->regmap))
>>                return PTR_ERR(aml_dma->regmap);
> 
> [Severity: Medium]
> Does this code leak the free_wq workqueue on this error path?
> 
> aml_dma->free_wq is allocated earlier in aml_dma_probe() using
> alloc_ordered_workqueue(), which isn't managed by devres:
> 
> drivers/dma/amlogic-dma.c:aml_dma_probe() {
>      ...
>          aml_dma->free_wq = alloc_ordered_workqueue("aml_dma_free", 0);
>          if (!aml_dma->free_wq)
>                  return -ENOMEM;
>      ...
> }
> 
> If devm_regmap_init_mmio() fails and we return directly here, there is
> no cleanup for the allocated workqueue.
> 

I will submit a patch separately to fix it.

>>
>>        aml_dma->clk = devm_clk_get_enabled(&pdev->dev, NULL);
> 
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261016-fix-a9-dma-complier-v1-1-024421d5b3c8@amlogic.com?part=1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

end of thread, other threads:[~2026-10-16  6:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16  3:00 [PATCH] dmaengine: amlogic: Fix regmap error check issue Xianwei Zhao via B4 Relay
2026-10-16  3:08 ` sashiko-bot
2026-10-16  6:41   ` Xianwei Zhao

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®