Skip to contentSkip to conversation

v4l: ti-vpe: checking for IS_ERR() instead of NULL

PATCH In review Dan Carpenter 2 participants 2 messages Nov 8, 2013

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

PATCH 1/1 v4l: ti-vpe: checking for IS_ERR() instead of NULL

devm_ioremap() returns NULL on error, it doesn't return an ERR_PTR.

drivers/media/platform/ti-vpe/vpe.c +2 -2
index 4e58069..e163466 100644
@@ -1962,8 +1962,8 @@ static int vpe_probe(struct platform_device *pdev)
 	 * registers based on the sub block base addresses
 	 */
 	dev->base = devm_ioremap(&pdev->dev, res->start, SZ_32K);
-	if (IS_ERR(dev->base)) {
-		ret = PTR_ERR(dev->base);
+	if (!dev->base) {
+		ret = -ENOMEM;
 		goto v4l2_dev_unreg;
 	}
 
#1 lore raw

Hi Dan,

Quoted 9 lines · Dan Carpenter

devm_ioremap() returns NULL on error, it doesn't return an ERR_PTR.

drivers/media/platform/ti-vpe/vpe.c +0 -0
index 4e58069..e163466 100644

drivers/media/platform/ti-vpe/vpe.c static int vpe_probe(struct platform_device *pdev) · line 1968

Quoted 9 lines
drivers/media/platform/ti-vpe/vpe.c +2 -2
@@ -1962,8 +1962,8 @@ static int vpe_probe(struct platform_device *pdev)
  	 * registers based on the sub block base addresses
  	 */
  	dev->base = devm_ioremap(&pdev->dev, res->start, SZ_32K);
-	if (IS_ERR(dev->base)) {
-		ret = PTR_ERR(dev->base);
+	if (!dev->base) {
+		ret = -ENOMEM;
  		goto v4l2_dev_unreg;
  	}

Thanks for the patch, this was addressed in Wei's patch though:

"v4l: ti-vpe: fix return value check in vpe_probe()"

Thanks,
Archit