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

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
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -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");