Skip to content

Commit

Permalink
net: phy: use of_mdio_parse_addr
Browse files Browse the repository at this point in the history
use of_mdio_parse_addr() in place of an OF read of reg and a bounds
check (which is litterally the exact same thing that
of_mdio_parse_addr() does)

Signed-off-by: Jon Mason <jon.mason@broadcom.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jon Mason authored and David S. Miller committed Jun 2, 2017
1 parent 775e68a commit d0a6540
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions drivers/net/phy/mdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,21 +263,10 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus,

for_each_available_child_of_node(bus->dev.of_node, child) {
int addr;
int ret;

ret = of_property_read_u32(child, "reg", &addr);
if (ret < 0) {
dev_err(dev, "%s has invalid MDIO address\n",
child->full_name);
addr = of_mdio_parse_addr(dev, child);
if (addr < 0)
continue;
}

/* A MDIO device must have a reg property in the range [0-31] */
if (addr >= PHY_MAX_ADDR) {
dev_err(dev, "%s MDIO address %i is too large\n",
child->full_name, addr);
continue;
}

if (addr == mdiodev->addr) {
dev->of_node = child;
Expand Down

0 comments on commit d0a6540

Please sign in to comment.