Skip to contentSkip to conversation

soc: ti: omap-prm: fix return value check in omap_prm_probe()

PATCH Applied Wei Yongjun 2 participants 2 messages Oct 11, 2019 – Oct 29, 2019

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

PATCH 1/1 soc: ti: omap-prm: fix return value check in omap_prm_probe()

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 3e99cb214f03 ("soc: ti: add initial PRM driver with reset control support")
---
 drivers/soc/ti/omap_prm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/ti/omap_prm.c +2 -2
index db47a8bceb87..96c6f777519c 100644
@@ -375,8 +375,8 @@ static int omap_prm_probe(struct platform_device *pdev)
 	prm->data = data;
 
 	prm->base = devm_ioremap_resource(&pdev->dev, res);
-	if (!prm->base)
-		return -ENOMEM;
+	if (IS_ERR(prm->base))
+		return PTR_ERR(prm->base);
 
 	return omap_prm_reset_init(pdev, prm);
 }
#1 lore raw
Quoted 7 lines · Wei Yongjun

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 3e99cb214f03 ("soc: ti: add initial PRM driver with reset control support")

---

Applied