]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: phy: xilinx: Break while loop over ethernet phy
authorMichal Simek <michal.simek@xilinx.com>
Mon, 26 Apr 2021 12:26:48 +0000 (14:26 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 29 Apr 2021 08:05:56 +0000 (10:05 +0200)
The commit 6c993815bbea ("net: phy: xilinx: Be compatible with live OF
tree") change driver behavior to while loop which wasn't correct because
the driver was looping over again and again. The reason was that
ofnode_valid() is taking 0 as correct value.
Fix it by changing while loop to ofnode_for_each_subnode() which is only
loop over available nodes.

Fixes: 6c993815bbea ("net: phy: xilinx: Be compatible with live OF tree")
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/net/phy/phy.c

index dcdef9e661d6fde76e5b33f7fb2af549db8cf093..ed197fa46d737593cf65439a00873d30f9b3dc6e 100644 (file)
@@ -948,9 +948,9 @@ static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus,
                                                 phy_interface_t interface)
 {
        struct phy_device *phydev = NULL;
-       ofnode node = dev_ofnode(dev);
+       ofnode node;
 
-       while (ofnode_valid(node)) {
+       ofnode_for_each_subnode(node, dev_ofnode(dev)) {
                node = ofnode_by_compatible(node, "xlnx,gmii-to-rgmii-1.0");
                if (ofnode_valid(node)) {
                        phydev = phy_device_create(bus, 0,