Commit c01ebd6c authored by Prashant Malani's avatar Prashant Malani Committed by David S. Miller

r8152: Use guard clause and fix comment typos

Use a guard clause in tx_bottom() to reduce the indentation of the
do-while loop.

Also, fix a couple of spelling and grammatical mistakes in the
r8152_csum_workaround() function comment.

Change-Id: I460befde150ad92248fd85b0f189ec2df2ab8431
Signed-off-by: default avatarPrashant Malani <pmalani@chromium.org>
Reviewed-by: default avatarGrant Grundler <grundler@chromium.org>
Acked-by: default avatarHayes Wang <hayeswang@realtek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a786ab36
...@@ -1688,7 +1688,7 @@ static struct tx_agg *r8152_get_tx_agg(struct r8152 *tp) ...@@ -1688,7 +1688,7 @@ static struct tx_agg *r8152_get_tx_agg(struct r8152 *tp)
} }
/* r8152_csum_workaround() /* r8152_csum_workaround()
* The hw limites the value the transport offset. When the offset is out of the * The hw limits the value of the transport offset. When the offset is out of
* range, calculate the checksum by sw. * range, calculate the checksum by sw.
*/ */
static void r8152_csum_workaround(struct r8152 *tp, struct sk_buff *skb, static void r8152_csum_workaround(struct r8152 *tp, struct sk_buff *skb,
...@@ -2178,6 +2178,7 @@ static void tx_bottom(struct r8152 *tp) ...@@ -2178,6 +2178,7 @@ static void tx_bottom(struct r8152 *tp)
int res; int res;
do { do {
struct net_device *netdev = tp->netdev;
struct tx_agg *agg; struct tx_agg *agg;
if (skb_queue_empty(&tp->tx_queue)) if (skb_queue_empty(&tp->tx_queue))
...@@ -2188,24 +2189,23 @@ static void tx_bottom(struct r8152 *tp) ...@@ -2188,24 +2189,23 @@ static void tx_bottom(struct r8152 *tp)
break; break;
res = r8152_tx_agg_fill(tp, agg); res = r8152_tx_agg_fill(tp, agg);
if (res) { if (!res)
struct net_device *netdev = tp->netdev; continue;
if (res == -ENODEV) { if (res == -ENODEV) {
rtl_set_unplug(tp); rtl_set_unplug(tp);
netif_device_detach(netdev); netif_device_detach(netdev);
} else { } else {
struct net_device_stats *stats = &netdev->stats; struct net_device_stats *stats = &netdev->stats;
unsigned long flags; unsigned long flags;
netif_warn(tp, tx_err, netdev, netif_warn(tp, tx_err, netdev,
"failed tx_urb %d\n", res); "failed tx_urb %d\n", res);
stats->tx_dropped += agg->skb_num; stats->tx_dropped += agg->skb_num;
spin_lock_irqsave(&tp->tx_lock, flags); spin_lock_irqsave(&tp->tx_lock, flags);
list_add_tail(&agg->list, &tp->tx_free); list_add_tail(&agg->list, &tp->tx_free);
spin_unlock_irqrestore(&tp->tx_lock, flags); spin_unlock_irqrestore(&tp->tx_lock, flags);
}
} }
} while (res == 0); } while (res == 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment