]> git.baikalelectronics.ru Git - kernel.git/commitdiff
r8169: don't try to read counters if chip is in a PCI power-save state
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 6 Jan 2019 19:44:00 +0000 (20:44 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Jan 2019 15:19:25 +0000 (07:19 -0800)
Avoid log spam caused by trying to read counters from the chip whilst
it is in a PCI power-save state.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=107421

Fixes: 1bc6ff9085d6 ("r8169: Dereference MMIO address immediately before use")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/realtek/r8169.c

index 7fe9180261b880f9f5cc7fd2a7b842798aaa5bf1..784ae5001656073d85bbc022a2c04d349333ae3b 100644 (file)
@@ -1681,11 +1681,13 @@ static bool rtl8169_reset_counters(struct rtl8169_private *tp)
 
 static bool rtl8169_update_counters(struct rtl8169_private *tp)
 {
+       u8 val = RTL_R8(tp, ChipCmd);
+
        /*
         * Some chips are unable to dump tally counters when the receiver
-        * is disabled.
+        * is disabled. If 0xff chip may be in a PCI power-save state.
         */
-       if ((RTL_R8(tp, ChipCmd) & CmdRxEnb) == 0)
+       if (!(val & CmdRxEnb) || val == 0xff)
                return true;
 
        return rtl8169_do_counters(tp, CounterDump);