aboutsummaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorMarek Vasut2020-03-15 15:43:20 +0100
committermarex2020-05-01 12:35:21 +0200
commit6f6cf0083f466c49c97c175b0169a0cd31c35d63 (patch)
tree0aa4014415e8a6389a727442274e310c321603b6 /drivers/net
parent49af0cb5a61c821d416ef069c6950d82523db585 (diff)
net: smc911x: Invert the logic in smc911x_miiphy_{read,write}()
Invert the logic in the aforementioned functions to reduce indent, no functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/smc911x.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 6da6c895469..ceb4f812152 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -216,24 +216,29 @@ static int smc911x_recv(struct eth_device *dev)
static int smc911x_miiphy_read(struct mii_dev *bus, int phy, int devad,
int reg)
{
- u16 val = 0;
struct eth_device *dev = eth_get_dev_by_name(bus->name);
- if (dev) {
- int retval = smc911x_eth_phy_read(dev, phy, reg, &val);
- if (retval < 0)
- return retval;
- return val;
- }
- return -ENODEV;
+ u16 val = 0;
+ int ret;
+
+ if (!dev)
+ return -ENODEV;
+
+ ret = smc911x_eth_phy_read(dev, phy, reg, &val);
+ if (ret < 0)
+ return ret;
+
+ return val;
}
/* wrapper for smc911x_eth_phy_write */
static int smc911x_miiphy_write(struct mii_dev *bus, int phy, int devad,
int reg, u16 val)
{
struct eth_device *dev = eth_get_dev_by_name(bus->name);
- if (dev)
- return smc911x_eth_phy_write(dev, phy, reg, val);
- return -ENODEV;
+
+ if (!dev)
+ return -ENODEV;
+
+ return smc911x_eth_phy_write(dev, phy, reg, val);
}
#endif