]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
phy: phy-ocelot-serdes: fix return value check in serdes_probe()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 10 Oct 2018 02:00:24 +0000 (02:00 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Oct 2018 05:54:26 +0000 (22:54 -0700)
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 <weiyongjun1@huawei.com>
Reviewed-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/phy/mscc/phy-ocelot-serdes.c

index 8936abd22f0f4d5298d42d46f361d9a1f4cde39e..b2be54680cf75b1db5860d5802bfec6704ae8476 100644 (file)
@@ -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]);