DMA Engine development
 help / color / mirror / Atom feed
* [PATCH] dmaengine: xilinx: xdma: Fix IS_ERR() vs NULL bug in xdma_probe()
@ 2024-08-19 19:36 Harshit Mogalapalli
  2024-08-19 20:11 ` Lizhi Hou
  2024-08-20 15:25 ` Lizhi Hou
  0 siblings, 2 replies; 4+ messages in thread
From: Harshit Mogalapalli @ 2024-08-19 19:36 UTC (permalink / raw)
  To: Lizhi Hou, Brian Xu, Raj Kumar Rampelli, Vinod Koul, Michal Simek,
	Sonal Santan, Max Zhen, dmaengine, linux-arm-kernel, linux-kernel
  Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli

devm_regmap_init_mmio() returns error pointers on error, it doesn't
return NULL. Update the error check.

Fixes: 17ce252266c7 ("dmaengine: xilinx: xdma: Add xilinx xdma driver")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is based on static analysis with smatch, only compile tested.
---
 drivers/dma/xilinx/xdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c
index 718842fdaf98..44fae351f0a0 100644
--- a/drivers/dma/xilinx/xdma.c
+++ b/drivers/dma/xilinx/xdma.c
@@ -1240,7 +1240,8 @@ static int xdma_probe(struct platform_device *pdev)
 
 	xdev->rmap = devm_regmap_init_mmio(&pdev->dev, reg_base,
 					   &xdma_regmap_config);
-	if (!xdev->rmap) {
+	if (IS_ERR(xdev->rmap)) {
+		ret = PTR_ERR(xdev->rmap);
 		xdma_err(xdev, "config regmap failed: %d", ret);
 		goto failed;
 	}
-- 
2.39.3


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

* Re: [PATCH] dmaengine: xilinx: xdma: Fix IS_ERR() vs NULL bug in xdma_probe()
  2024-08-19 19:36 [PATCH] dmaengine: xilinx: xdma: Fix IS_ERR() vs NULL bug in xdma_probe() Harshit Mogalapalli
@ 2024-08-19 20:11 ` Lizhi Hou
  2024-08-19 20:38   ` Dan Carpenter
  2024-08-20 15:25 ` Lizhi Hou
  1 sibling, 1 reply; 4+ messages in thread
From: Lizhi Hou @ 2024-08-19 20:11 UTC (permalink / raw)
  To: Harshit Mogalapalli, Brian Xu, Raj Kumar Rampelli, Vinod Koul,
	Michal Simek, Sonal Santan, Max Zhen, dmaengine, linux-arm-kernel,
	linux-kernel, Vinod Koul
  Cc: dan.carpenter, kernel-janitors, error27


It looks a dup of

https://lore.kernel.org/dmaengine/CALYqZ9=pVRtSY=w4hG0R3HEM_Y=bpLba2_jRcvcZX4eLX5Yw-A@mail.gmail.com/


Thanks,

Lizhi

On 8/19/24 12:36, Harshit Mogalapalli wrote:
> devm_regmap_init_mmio() returns error pointers on error, it doesn't
> return NULL. Update the error check.
>
> Fixes: 17ce252266c7 ("dmaengine: xilinx: xdma: Add xilinx xdma driver")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> This is based on static analysis with smatch, only compile tested.
> ---
>   drivers/dma/xilinx/xdma.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c
> index 718842fdaf98..44fae351f0a0 100644
> --- a/drivers/dma/xilinx/xdma.c
> +++ b/drivers/dma/xilinx/xdma.c
> @@ -1240,7 +1240,8 @@ static int xdma_probe(struct platform_device *pdev)
>   
>   	xdev->rmap = devm_regmap_init_mmio(&pdev->dev, reg_base,
>   					   &xdma_regmap_config);
> -	if (!xdev->rmap) {
> +	if (IS_ERR(xdev->rmap)) {
> +		ret = PTR_ERR(xdev->rmap);
>   		xdma_err(xdev, "config regmap failed: %d", ret);
>   		goto failed;
>   	}

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

* Re: [PATCH] dmaengine: xilinx: xdma: Fix IS_ERR() vs NULL bug in xdma_probe()
  2024-08-19 20:11 ` Lizhi Hou
@ 2024-08-19 20:38   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2024-08-19 20:38 UTC (permalink / raw)
  To: Lizhi Hou, Eric Debief
  Cc: Harshit Mogalapalli, Brian Xu, Raj Kumar Rampelli, Vinod Koul,
	Michal Simek, Sonal Santan, Max Zhen, dmaengine, linux-arm-kernel,
	linux-kernel, kernel-janitors, error27

On Mon, Aug 19, 2024 at 01:11:34PM -0700, Lizhi Hou wrote:
> 
> It looks a dup of
> 
> https://lore.kernel.org/dmaengine/CALYqZ9=pVRtSY=w4hG0R3HEM_Y=bpLba2_jRcvcZX4eLX5Yw-A@mail.gmail.com/
> 

That patch was sent in May.  It was sent in an unusable format but no one
responded to it so it was never fixed.  :/  Eric, please read the first two
paragraphs of Documentation/process/email-clients.rst.

I suggest we add merge this patch but with Eric as a Reported-by.

regards,
dan carpenter


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

* Re: [PATCH] dmaengine: xilinx: xdma: Fix IS_ERR() vs NULL bug in xdma_probe()
  2024-08-19 19:36 [PATCH] dmaengine: xilinx: xdma: Fix IS_ERR() vs NULL bug in xdma_probe() Harshit Mogalapalli
  2024-08-19 20:11 ` Lizhi Hou
@ 2024-08-20 15:25 ` Lizhi Hou
  1 sibling, 0 replies; 4+ messages in thread
From: Lizhi Hou @ 2024-08-20 15:25 UTC (permalink / raw)
  To: Harshit Mogalapalli, Brian Xu, Raj Kumar Rampelli, Vinod Koul,
	Michal Simek, Sonal Santan, Max Zhen, dmaengine, linux-arm-kernel,
	linux-kernel
  Cc: dan.carpenter, kernel-janitors, error27


On 8/19/24 12:36, Harshit Mogalapalli wrote:
> devm_regmap_init_mmio() returns error pointers on error, it doesn't
> return NULL. Update the error check.
>
> Fixes: 17ce252266c7 ("dmaengine: xilinx: xdma: Add xilinx xdma driver")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> This is based on static analysis with smatch, only compile tested.
> ---
>   drivers/dma/xilinx/xdma.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c
> index 718842fdaf98..44fae351f0a0 100644
> --- a/drivers/dma/xilinx/xdma.c
> +++ b/drivers/dma/xilinx/xdma.c
> @@ -1240,7 +1240,8 @@ static int xdma_probe(struct platform_device *pdev)
>   
>   	xdev->rmap = devm_regmap_init_mmio(&pdev->dev, reg_base,
>   					   &xdma_regmap_config);
> -	if (!xdev->rmap) {
> +	if (IS_ERR(xdev->rmap)) {
> +		ret = PTR_ERR(xdev->rmap);
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
>   		xdma_err(xdev, "config regmap failed: %d", ret);
>   		goto failed;
>   	}

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

end of thread, other threads:[~2024-08-20 15:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-19 19:36 [PATCH] dmaengine: xilinx: xdma: Fix IS_ERR() vs NULL bug in xdma_probe() Harshit Mogalapalli
2024-08-19 20:11 ` Lizhi Hou
2024-08-19 20:38   ` Dan Carpenter
2024-08-20 15:25 ` Lizhi Hou

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