Skip to content

Commit

Permalink
net: phy: Use IS_ERR() to check and simplify code
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Tang Bin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Tang Bin authored and davem330 committed Apr 23, 2020
1 parent bcf3440 commit d0f0c55
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/net/phy/mdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@

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");
Expand Down

0 comments on commit d0f0c55

Please sign in to comment.