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 <hulkci@huawei.com>
Fixes: 71dd6c0dff ("net: phy: add support for reset-controller")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
YueHaibing 2019-11-11 15:13:47 +08:00 committed by David S. Miller
parent a71a29f50d
commit 1d4639567d

View File

@ -64,11 +64,12 @@ static int mdiobus_register_reset(struct mdio_device *mdiodev)
if (mdiodev->dev.of_node) if (mdiodev->dev.of_node)
reset = devm_reset_control_get_exclusive(&mdiodev->dev, reset = devm_reset_control_get_exclusive(&mdiodev->dev,
"phy"); "phy");
if (PTR_ERR(reset) == -ENOENT || if (IS_ERR(reset)) {
PTR_ERR(reset) == -ENOTSUPP) if (PTR_ERR(reset) == -ENOENT || PTR_ERR(reset) == -ENOSYS)
reset = NULL; reset = NULL;
else if (IS_ERR(reset)) else
return PTR_ERR(reset); return PTR_ERR(reset);
}
mdiodev->reset_ctrl = reset; mdiodev->reset_ctrl = reset;