[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190609180621.7607-2-martin.blumenstingl@googlemail.com>
Date: Sun, 9 Jun 2019 20:06:17 +0200
From: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
To: netdev@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-amlogic@...ts.infradead.org, linus.walleij@...aro.org,
bgolaszewski@...libre.com, peppe.cavallaro@...com,
alexandre.torgue@...com, joabreu@...opsys.com
Cc: devicetree@...r.kernel.org, davem@...emloft.net,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
khilman@...libre.com, narmstrong@...libre.com,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>
Subject: [RFC next v1 1/5] net: stmmac: drop redundant check in stmmac_mdio_reset
A simplified version of the existing code looks like this:
if (priv->device->of_node) {
struct device_node *np = priv->device->of_node;
if (!np)
return 0;
The second "if" never evaluates to true because the first "if" checks
for exactly the opposite.
Drop the redundant check and early return to make the code easier to
understand.
No functional changes intended.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 093a223fe408..cb9aad090cc9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -254,9 +254,6 @@ int stmmac_mdio_reset(struct mii_bus *bus)
if (data->reset_gpio < 0) {
struct device_node *np = priv->device->of_node;
- if (!np)
- return 0;
-
data->reset_gpio = of_get_named_gpio(np,
"snps,reset-gpio", 0);
if (data->reset_gpio < 0)
--
2.21.0
Powered by blists - more mailing lists