Skip to content

Commit

Permalink
net: stmmac: drop redundant check in stmmac_mdio_reset
Browse files Browse the repository at this point in the history
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@googlemail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Martin Blumenstingl authored and David S. Miller committed Jun 16, 2019
1 parent a514862 commit 626c5fe
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,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;

reset_gpio = devm_gpiod_get_optional(priv->device,
"snps,reset",
GPIOD_OUT_LOW);
Expand Down

0 comments on commit 626c5fe

Please sign in to comment.