net: mdiobus: get rid of a BUG_ON()
Subsystems (4)
PATCH 1/1 net: mdiobus: get rid of a BUG_ON()
We spotted a bug recently during a review where a driver was unregistering a bus that wasn't registered, which would trigger this BUG_ON(). Let's handle that situation more gracefully, and just print a warning and return.
--- drivers/net/phy/mdio_bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/mdio_bus.c +2 -1
@@ -607,7 +607,8 @@ void mdiobus_unregister(struct mii_bus *bus)struct mdio_device *mdiodev;int i; -BUG_ON (bus->state !=MDIOBUS_REGISTERED ); +if (WARN_ON_ONCE (bus->state !=MDIOBUS_REGISTERED )) +return ; bus->state =MDIOBUS_UNREGISTERED ;for (i =0 ; i <PHY_MAX_ADDR ; i++) {
Signature · 1 line
2.30.2
Quoted 6 lines · Dan Carpenter
We spotted a bug recently during a review where a driver was unregistering a bus that wasn't registered, which would trigger this
BUG_ON(). Let's handle that situation more gracefully, and just print a warning and return.Reported-by Russell King <[email protected]>
This probably ought to be updated to:
now please.
Quoted 1 line
Signed-off-by Dan Carpenter <[email protected]>
Quoted 22 lines
--- drivers/net/phy/mdio_bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/phy/mdio_bus.c +2
-1@@ -607,7 +607,8 @@ void mdiobus_unregister(struct mii_bus *bus)struct mdio_device *mdiodev;int i; -BUG_ON (bus->state !=MDIOBUS_REGISTERED ); +if (WARN_ON_ONCE (bus->state !=MDIOBUS_REGISTERED )) +return ; bus->state =MDIOBUS_UNREGISTERED ;for (i =0 ; i <PHY_MAX_ADDR ; i++) {Signature · 1 line
2.30.2
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Quoted 7 lines · Dan Carpenter
We spotted a bug recently during a review where a driver was unregistering a bus that wasn't registered, which would trigger this
BUG_ON(). Let's handle that situation more gracefully, and just print a warning and return.Reported-by Russell King <[email protected]>Signed-off-by Dan Carpenter <[email protected]>
Andrew
PATCH v2 1/1 net: mdiobus: get rid of a BUG_ON()
In reply to Russell King (Oracle)We spotted a bug recently during a review where a driver was unregistering a bus that wasn't registered, which would trigger this BUG_ON(). Let's handle that situation more gracefully, and just print a warning and return.
---
v2: Update the Reported-by tag.
drivers/net/phy/mdio_bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/mdio_bus.c +2 -1
@@ -607,7 +607,8 @@ void mdiobus_unregister(struct mii_bus *bus)struct mdio_device *mdiodev;int i; -BUG_ON (bus->state !=MDIOBUS_REGISTERED ); +if (WARN_ON_ONCE (bus->state !=MDIOBUS_REGISTERED )) +return ; bus->state =MDIOBUS_UNREGISTERED ;for (i =0 ; i <PHY_MAX_ADDR ; i++) {
Signature · 1 line
2.30.2
This patch was applied to netdev/net.git (refs/heads/master):
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
Quoted 11 lines · On Mon, 17 May 2021 12:04:13 +0300 you wrote:
We spotted a bug recently during a review where a driver was unregistering a bus that wasn't registered, which would trigger this
BUG_ON(). Let's handle that situation more gracefully, and just print a warning and return.Reported-by Russell King (Oracle) <[email protected]>Signed-off-by Dan Carpenter <[email protected]>Reviewed-by Russell King (Oracle) <[email protected]>Reviewed-by Andrew Lunn <[email protected]>[...]
Here is the summary with links:
- [net,v2] net: mdiobus: get rid of a BUG_ON()
https://git.kernel.org/netdev/net/c/1dde47a66d4f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html