mirror of https://gitee.com/openkylin/linux.git
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: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
bcf3440c6d
commit
d0f0c55e7c
|
@ -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");
|
||||||
|
|
Loading…
Reference in New Issue