]> git.baikalelectronics.ru Git - kernel.git/commit
of: of_mdio: Correct loop scanning logic
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 19 Jun 2020 18:47:46 +0000 (11:47 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Jun 2020 20:39:00 +0000 (13:39 -0700)
commit8b00d9b01e31fef165b13e69a5a7121a6b7c75ac
tree32fbb132c1fdc53a753d18f0b7ab2c605975fb08
parent5efd89907ca6c00acf19a655880fffb4ac46bfb6
of: of_mdio: Correct loop scanning logic

Commit c24c7c99e086 ("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: c24c7c99e086 ("drivers/of/of_mdio.c:fix of_mdiobus_register()")
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/of/of_mdio.c