r8169: replace BUG_ON with WARN in _rtl_eri_write
authorHeiner Kallweit <hkallweit1@gmail.com>
Fri, 8 Jan 2021 11:57:57 +0000 (12:57 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sun, 10 Jan 2021 02:07:52 +0000 (18:07 -0800)
Use WARN here to avoid stopping the system. In addition print the addr
and mask values that triggered the warning.

v2:
- return on WARN to avoid an invalid register write

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/realtek/r8169_main.c

index c9abc7c..317b347 100644 (file)
@@ -763,7 +763,9 @@ static void _rtl_eri_write(struct rtl8169_private *tp, int addr, u32 mask,
 {
        u32 cmd = ERIAR_WRITE_CMD | type | mask | addr;
 
-       BUG_ON((addr & 3) || (mask == 0));
+       if (WARN(addr & 3 || !mask, "addr: 0x%x, mask: 0x%08x\n", addr, mask))
+               return;
+
        RTL_W32(tp, ERIDR, val);
        r8168fp_adjust_ocp_cmd(tp, &cmd, type);
        RTL_W32(tp, ERIAR, cmd);