Skip to contentSkip to conversation

drm/pl111: Fix return value check in pl111_amba_probe()

PATCH In review Wei Yongjun 2 participants 2 messages May 21, 2017 – May 22, 2017

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

PATCH 1/1 drm/pl111: Fix return value check in pl111_amba_probe()

From: Wei Yongjun <[email protected]>

In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Fixes bed41005e617 ("drm/pl111: Initial drm/kms driver for pl111")
---
 drivers/gpu/drm/pl111/pl111_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/pl111/pl111_drv.c +2 -2
index 936403f..c6b93ff 100644
@@ -203,9 +203,9 @@ static int pl111_amba_probe(struct amba_device *amba_dev,
 	}
 
 	priv->regs = devm_ioremap_resource(dev, &amba_dev->res);
-	if (!priv->regs) {
+	if (IS_ERR(priv->regs)) {
 		dev_err(dev, "%s failed mmio\n", __func__);
-		return -EINVAL;
+		return PTR_ERR(priv->regs);
 	}
 
 	/* turn off interrupts before requesting the irq */
#1 lore raw
Quoted 8 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Fixes bed41005e617 ("drm/pl111: Initial drm/kms driver for pl111")

Reviewed and applied. Thanks!

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel