Skip to content

Commit

Permalink
phy: phy-ocelot-serdes: fix return value check in serdes_probe()
Browse files Browse the repository at this point in the history
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: 51f6b41 ("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>
  • Loading branch information
Wei Yongjun authored and David S. Miller committed Oct 11, 2018
1 parent 302d20e commit 9047fa5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/phy/mscc/phy-ocelot-serdes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 9047fa5

Please sign in to comment.