mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: phy: Use IS_ERR() to check and simplify code
@ 2020-04-22  8:15 Tang Bin
  2020-04-23  2:40 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Tang Bin @ 2020-04-22  8:15 UTC (permalink / raw)
  To: andrew, f.fainelli, hkallweit1, linux, davem
  Cc: netdev, linux-kernel, Tang Bin, Zhang Shengju

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>
---
 drivers/net/phy/mdio_bus.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 9bb9f37f2..b1114f204 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -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");
-- 
2.20.1.windows.1




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: phy: Use IS_ERR() to check and simplify code
  2020-04-22  8:15 [PATCH] net: phy: Use IS_ERR() to check and simplify code Tang Bin
@ 2020-04-23  2:40 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-04-23  2:40 UTC (permalink / raw)
  To: tangbin
  Cc: andrew, f.fainelli, hkallweit1, linux, netdev, linux-kernel,
	zhangshengju

From: Tang Bin <tangbin@cmss.chinamobile.com>
Date: Wed, 22 Apr 2020 16:15:42 +0800

> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-23  2:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22  8:15 [PATCH] net: phy: Use IS_ERR() to check and simplify code Tang Bin
2020-04-23  2:40 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®