Skip to content
  • Florian Fainelli's avatar
    of: of_mdio: Correct loop scanning logic · 5a8d7f12
    Florian Fainelli authored
    Commit 209c65b6 ("drivers/of/of_mdio.c:fix of_mdiobus_register()")
    introduced a break of the loop on the premise that a successful
    registration should exit the loop. The premise is correct but not to
    code, because rc && rc != -ENODEV is just a special error condition,
    that means we would exit the loop even with rc == -ENODEV which is
    absolutely not correct since this is the error code to indicate to the
    MDIO bus layer that scanning should continue.
    
    Fix this by explicitly checking for rc = 0 as the only valid condition
    to break out of the loop.
    
    Fixes: 209c65b6
    
     ("drivers/of/of_mdio.c:fix of_mdiobus_register()")
    Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
    Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    5a8d7f12