From: Hayes Wang Subject: [PATCH net-next 2/7] r8152: check tx agg list before spin lock Date: Fri, 7 Mar 2014 11:04:35 +0800 Message-ID: <1394161480-2918-3-git-send-email-hayeswang@realtek.com> References: <1393934464-23675-1-git-send-email-hayeswang@realtek.com> <1394161480-2918-1-git-send-email-hayeswang@realtek.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , , Hayes Wang To: Return-path: In-Reply-To: <1394161480-2918-1-git-send-email-hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org> Sender: linux-usb-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: netdev.vger.kernel.org Check tx agg list before spin lock to avoid doing spin lock every times. Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 8ecb41b..00b3192 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1266,6 +1266,9 @@ static struct tx_agg *r8152_get_tx_agg(struct r8152 *tp) struct tx_agg *agg = NULL; unsigned long flags; + if (list_empty(&tp->tx_free)) + return NULL; + spin_lock_irqsave(&tp->tx_lock, flags); if (!list_empty(&tp->tx_free)) { struct list_head *cursor; -- 1.8.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html