net: phy: Use IS_ERR() to check and simplify code
authorTang Bin <tangbin@cmss.chinamobile.com>
Wed, 22 Apr 2020 08:15:42 +0000 (16:15 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 Apr 2020 02:40:07 +0000 (19:40 -0700)
Use IS_ERR() and PTR_ERR() instead of PTR_ZRR_OR_ZERO()
to simplify code, avoid redundant paramenter definitions
and judgements.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mdio_bus.c

index 26b00af945737eb7c9f745977612d681178a7282..3e79b96fa344b27bb492d0446aabb08f9b7b8020 100644 (file)
 
 static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
 {
-       int error;
-
        /* Deassert the optional reset signal */
        mdiodev->reset_gpio = gpiod_get_optional(&mdiodev->dev,
                                                 "reset", GPIOD_OUT_LOW);
-       error = PTR_ERR_OR_ZERO(mdiodev->reset_gpio);
-       if (error)
-               return error;
+       if (IS_ERR(mdiodev->reset_gpio))
+               return PTR_ERR(mdiodev->reset_gpio);
 
        if (mdiodev->reset_gpio)
                gpiod_set_consumer_name(mdiodev->reset_gpio, "PHY reset");