Commit d0a65400 authored by Jon Mason's avatar Jon Mason Committed by David S. Miller

net: phy: use of_mdio_parse_addr

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: default avatarJon Mason <jon.mason@broadcom.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 775e68a9
...@@ -263,21 +263,10 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus, ...@@ -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) { for_each_available_child_of_node(bus->dev.of_node, child) {
int addr; int addr;
int ret;
ret = of_property_read_u32(child, "reg", &addr); addr = of_mdio_parse_addr(dev, child);
if (ret < 0) { if (addr < 0)
dev_err(dev, "%s has invalid MDIO address\n",
child->full_name);
continue; 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) { if (addr == mdiodev->addr) {
dev->of_node = child; dev->of_node = child;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment