Skip to contentSkip to conversation

dmaengine: sprd: fix an NULL vs IS_ERR() bug

PATCH Dan Carpenter 1 participant 1 message May 16, 2018

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

We recently cleaned this code up but we need to update the error handling as well. The devm_ioremap_resource() returns error pointers on error, never NULL.

Fixes e7f063ae1a31 ("dmaengine: sprd: Use devm_ioremap_resource() to map memory")

---
To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

drivers/dma/sprd-dma.c +2 -2
index e715d07aa632..36df3b096bbc 100644
@@ -808,8 +808,8 @@ static int sprd_dma_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	sdev->glb_base = devm_ioremap_resource(&pdev->dev, res);
-	if (!sdev->glb_base)
-		return -ENOMEM;
+	if (IS_ERR(sdev->glb_base))
+		return PTR_ERR(sdev->glb_base);
 
 	dma_cap_set(DMA_MEMCPY, sdev->dma_dev.cap_mask);
 	sdev->total_chns = chn_count;