提交 d0f0c55e 编写于 作者: T Tang Bin 提交者: 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: NZhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: NTang Bin <tangbin@cmss.chinamobile.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册