Skip to content

Commit 1d46395

Browse files
YueHaibingdavem330
authored andcommitted
mdio_bus: Fix PTR_ERR applied after initialization to constant
Fix coccinelle warning: ./drivers/net/phy/mdio_bus.c:67:5-12: ERROR: PTR_ERR applied after initialization to constant on line 62 ./drivers/net/phy/mdio_bus.c:68:5-12: ERROR: PTR_ERR applied after initialization to constant on line 62 Fix this by using IS_ERR before PTR_ERR Reported-by: Hulk Robot <[email protected]> Fixes: 71dd6c0 ("net: phy: add support for reset-controller") Signed-off-by: YueHaibing <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a71a29f commit 1d46395

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/net/phy/mdio_bus.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ static int mdiobus_register_reset(struct mdio_device *mdiodev)
6464
if (mdiodev->dev.of_node)
6565
reset = devm_reset_control_get_exclusive(&mdiodev->dev,
6666
"phy");
67-
if (PTR_ERR(reset) == -ENOENT ||
68-
PTR_ERR(reset) == -ENOTSUPP)
69-
reset = NULL;
70-
else if (IS_ERR(reset))
71-
return PTR_ERR(reset);
67+
if (IS_ERR(reset)) {
68+
if (PTR_ERR(reset) == -ENOENT || PTR_ERR(reset) == -ENOSYS)
69+
reset = NULL;
70+
else
71+
return PTR_ERR(reset);
72+
}
7273

7374
mdiodev->reset_ctrl = reset;
7475

0 commit comments

Comments
 (0)