Skip to contentSkip to conversation

dmaengine: xilinx: xdma: fix return value check in xdma_probe()

PATCH In review Yang Yingliang 2 participants 2 messages Feb 17, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: xilinx: xdma: fix return value check in xdma_probe()

devm_ioremap_resource() never returns NULL pointer, it will return ERR_PTR() when it fails, so replace the check with IS_ERR().

Fixes 17ce252266c7 ("dmaengine: xilinx: xdma: Add xilinx xdma driver")
---
 drivers/dma/xilinx/xdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/xilinx/xdma.c +2 -1
index 462109c61653..1c836cbdafa1 100644
@@ -892,8 +892,9 @@ static int xdma_probe(struct platform_device *pdev)
 	}
 
 	reg_base = devm_ioremap_resource(&pdev->dev, res);
-	if (!reg_base) {
+	if (IS_ERR(reg_base)) {
 		xdma_err(xdev, "ioremap failed");
+		ret = PTR_ERR(reg_base);
 		goto failed;
 	}
 
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yang" == Yang Yingliang <[email protected]> writes:

devm_ioremap_resource() never returns NULL pointer, it will return ERR_PTR() when it fails, so replace the check with IS_ERR().

Fixes 17ce252266c7 ("dmaengine: xilinx: xdma: Add xilinx xdma driver")
Quoted 22 lines
---
 drivers/dma/xilinx/xdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/xilinx/xdma.c +2 -1
index 462109c61653..1c836cbdafa1 100644
@@ -892,8 +892,9 @@ static int xdma_probe(struct platform_device *pdev)
 	}
 
 	reg_base = devm_ioremap_resource(&pdev->dev, res);
-	if (!reg_base) {
+	if (IS_ERR(reg_base)) {
 		xdma_err(xdev, "ioremap failed");
+		ret = PTR_ERR(reg_base);
 		goto failed;
 	}
 
Signature · 1 line
2.25.1
Signature · 1 line
Bye, Peter Korsgaard