From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net] net: mdiobus: get rid of a BUG_ON()
Date: Sat, 15 May 2021 11:15:22 +0100 [thread overview]
Message-ID: <20210515101522.GM12395@shell.armlinux.org.uk> (raw)
In-Reply-To: <YJ+b52c5bGLdewFz@mwanda>
On Sat, May 15, 2021 at 01:01:11PM +0300, Dan Carpenter 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 <linux@armlinux.org.uk>
This probably ought to be updated to:
Reported-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
now please.
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> drivers/net/phy/mdio_bus.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index dadf75ff3ab9..6045ad3def12 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -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++) {
> --
> 2.30.2
>
>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2021-05-15 10:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 10:01 [PATCH net] net: mdiobus: get rid of a BUG_ON() Dan Carpenter
2021-05-15 10:15 ` Russell King (Oracle) [this message]
2021-05-17 9:04 ` [PATCH net v2] " Dan Carpenter
2021-05-17 23:00 ` patchwork-bot+netdevbpf
2021-05-15 14:06 ` [PATCH net] " Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210515101522.GM12395@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).