mirror of https://gitee.com/openkylin/linux.git
net: mdiobus: avoid BUG_ON() in mdiobus accessors
Avoid using BUG_ON() in the mdiobus accessors, prefering instead to use WARN_ON_ONCE() and returning an error. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
54e1dc70dc
commit
89e3e3ddcb
|
@ -841,7 +841,8 @@ int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum)
|
|||
{
|
||||
int retval;
|
||||
|
||||
BUG_ON(in_interrupt());
|
||||
if (WARN_ON_ONCE(in_interrupt()))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
||||
retval = __mdiobus_read(bus, addr, regnum);
|
||||
|
@ -865,7 +866,8 @@ int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum)
|
|||
{
|
||||
int retval;
|
||||
|
||||
BUG_ON(in_interrupt());
|
||||
if (WARN_ON_ONCE(in_interrupt()))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&bus->mdio_lock);
|
||||
retval = __mdiobus_read(bus, addr, regnum);
|
||||
|
@ -893,7 +895,8 @@ int mdiobus_write_nested(struct mii_bus *bus, int addr, u32 regnum, u16 val)
|
|||
{
|
||||
int err;
|
||||
|
||||
BUG_ON(in_interrupt());
|
||||
if (WARN_ON_ONCE(in_interrupt()))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
||||
err = __mdiobus_write(bus, addr, regnum, val);
|
||||
|
@ -918,7 +921,8 @@ int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val)
|
|||
{
|
||||
int err;
|
||||
|
||||
BUG_ON(in_interrupt());
|
||||
if (WARN_ON_ONCE(in_interrupt()))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&bus->mdio_lock);
|
||||
err = __mdiobus_write(bus, addr, regnum, val);
|
||||
|
|
Loading…
Reference in New Issue