diff mbox series

[net] r8169: don't try to read counters if chip is in a PCI power-save state

Message ID a2e32666-71a6-bbd0-9f0f-13c9233f538a@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series [net] r8169: don't try to read counters if chip is in a PCI power-save state | expand

Commit Message

Heiner Kallweit Jan. 6, 2019, 7:44 p.m. UTC
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: 1ef7286e7f36 ("r8169: Dereference MMIO address immediately before use")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

David Miller Jan. 7, 2019, 3:22 p.m. UTC | #1
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sun, 6 Jan 2019 20:44:00 +0100

> 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: 1ef7286e7f36 ("r8169: Dereference MMIO address immediately before use")
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied and queued up for -stable, thanks Heiner.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index c6b98024b..8265c1824 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1682,11 +1682,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);