[PATCH -next] phy: phy-ocelot-serdes: fix return value check in serdes_probe()

Subsystems: generic phy framework, the rest

STALE2891d

3 messages, 3 authors, 2018-10-11 · open the first message on its own page

[PATCH -next] phy: phy-ocelot-serdes: fix return value check in serdes_probe()

From: Wei Yongjun <hidden>
Date: 2018-10-10 01:49:23

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

Fixes: 51f6b410fc22 ("phy: add driver for Microsemi Ocelot SerDes muxing")
Signed-off-by: Wei Yongjun <redacted>
---
 drivers/phy/mscc/phy-ocelot-serdes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/mscc/phy-ocelot-serdes.c b/drivers/phy/mscc/phy-ocelot-serdes.c
index 8936abd..b2be546 100644
--- a/drivers/phy/mscc/phy-ocelot-serdes.c
+++ b/drivers/phy/mscc/phy-ocelot-serdes.c
@@ -257,8 +257,8 @@ static int serdes_probe(struct platform_device *pdev)
 
 	ctrl->dev = &pdev->dev;
 	ctrl->regs = syscon_node_to_regmap(pdev->dev.parent->of_node);
-	if (!ctrl->regs)
-		return -ENODEV;
+	if (IS_ERR(ctrl->regs))
+		return PTR_ERR(ctrl->regs);
 
 	for (i = 0; i <= SERDES_MAX; i++) {
 		ret = serdes_phy_create(ctrl, i, &ctrl->phys[i]);

Re: [PATCH -next] phy: phy-ocelot-serdes: fix return value check in serdes_probe()

From: Quentin Schulz <hidden>
Date: 2018-10-10 06:44:07

Hi Wei Yongjun,

On Wed, Oct 10, 2018 at 02:00:24AM +0000, Wei Yongjun wrote:
In case of error, the function syscon_node_to_regmap() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: 51f6b410fc22 ("phy: add driver for Microsemi Ocelot SerDes muxing")
Reviewed-by: Quentin Schulz <redacted>

Thanks!
Quentin

Re: [PATCH -next] phy: phy-ocelot-serdes: fix return value check in serdes_probe()

From: David Miller <davem@davemloft.net>
Date: 2018-10-11 05:54:51

From: Wei Yongjun <redacted>
Date: Wed, 10 Oct 2018 02:00:24 +0000
In case of error, the function syscon_node_to_regmap() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: 51f6b410fc22 ("phy: add driver for Microsemi Ocelot SerDes muxing")
Signed-off-by: Wei Yongjun <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help