r8169: improve rtl8169_rx_fill
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 23 Oct 2019 19:36:14 +0000 (21:36 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Oct 2019 03:28:59 +0000 (20:28 -0700)
We have only one user of the error path, so we can inline it.
In addition the call to rtl8169_make_unusable_by_asic() can be removed
because rtl8169_alloc_rx_data() didn't call rtl8169_mark_to_asic() yet
for the respective index if returning NULL.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/realtek/r8169_main.c

index 43ffd4f49c091eb0299f9cd77a9a90edc6909faa..91978ce92e20f0b55b08d2414523a8a2f86910a5 100644 (file)
@@ -5493,18 +5493,15 @@ static int rtl8169_rx_fill(struct rtl8169_private *tp)
 
                data = rtl8169_alloc_rx_data(tp, tp->RxDescArray + i);
                if (!data) {
-                       rtl8169_make_unusable_by_asic(tp->RxDescArray + i);
-                       goto err_out;
+                       rtl8169_rx_clear(tp);
+                       return -ENOMEM;
                }
                tp->Rx_databuff[i] = data;
        }
 
        rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1);
-       return 0;
 
-err_out:
-       rtl8169_rx_clear(tp);
-       return -ENOMEM;
+       return 0;
 }
 
 static int rtl8169_init_ring(struct rtl8169_private *tp)