Commit d0f0c55e authored by Tang Bin's avatar Tang Bin Committed by David S. Miller

net: phy: Use IS_ERR() to check and simplify code

Use IS_ERR() and PTR_ERR() instead of PTR_ZRR_OR_ZERO()
to simplify code, avoid redundant paramenter definitions
and judgements.
Signed-off-by: default avatarZhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: default avatarTang Bin <tangbin@cmss.chinamobile.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bcf3440c
...@@ -42,14 +42,11 @@ ...@@ -42,14 +42,11 @@
static int mdiobus_register_gpiod(struct mdio_device *mdiodev) static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
{ {
int error;
/* Deassert the optional reset signal */ /* Deassert the optional reset signal */
mdiodev->reset_gpio = gpiod_get_optional(&mdiodev->dev, mdiodev->reset_gpio = gpiod_get_optional(&mdiodev->dev,
"reset", GPIOD_OUT_LOW); "reset", GPIOD_OUT_LOW);
error = PTR_ERR_OR_ZERO(mdiodev->reset_gpio); if (IS_ERR(mdiodev->reset_gpio))
if (error) return PTR_ERR(mdiodev->reset_gpio);
return error;
if (mdiodev->reset_gpio) if (mdiodev->reset_gpio)
gpiod_set_consumer_name(mdiodev->reset_gpio, "PHY reset"); gpiod_set_consumer_name(mdiodev->reset_gpio, "PHY reset");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment