net: cdc_ncm: do not start timer on an empty skb

We can end up with a freshly allocated tx_curr_skb with no frames
in it.  In this case it does not make any sense to start the timer.
This avoids the timer periodically trying to start tx when there
is nothing in the queue.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Bjørn Mork 2014-05-16 21:48:29 +02:00 committed by David S. Miller
parent fa83dbeee5
commit 046c65946e
1 changed files with 2 additions and 2 deletions

View File

@ -1069,8 +1069,8 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
return skb_out;
exit_no_skb:
/* Start timer, if there is a remaining skb */
if (ctx->tx_curr_skb != NULL)
/* Start timer, if there is a remaining non-empty skb */
if (ctx->tx_curr_skb != NULL && n > 0)
cdc_ncm_tx_timeout_start(ctx);
return NULL;
}