Skip to content

Commit

Permalink
mt76x02u: remove bogus check and comment padding
Browse files Browse the repository at this point in the history
In mt76x02u_skb_dma_info() pad is always non-zero. Patch removes
bogus check and add comments to the function.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
Stanislaw Gruszka authored and nbd168 committed Feb 18, 2019
1 parent 0cee180 commit 1bb97c4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions mt76x02_usb_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags)
FIELD_PREP(MT_TXD_INFO_DPORT, port) | flags;
put_unaligned_le32(info, skb_push(skb, sizeof(info)));

/* Add zero pad of 4 - 7 bytes */
pad = round_up(skb->len, 4) + 4 - skb->len;

/* First packet of a A-MSDU burst keeps track of the whole burst
* length, need to update lenght of it and the last packet.
*/
skb_walk_frags(skb, iter) {
last = iter;
if (!iter->next) {
Expand All @@ -59,11 +64,10 @@ int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags)
}
}

if (unlikely(pad)) {
if (skb_pad(last, pad))
return -ENOMEM;
__skb_put(last, pad);
}
if (skb_pad(last, pad))
return -ENOMEM;
__skb_put(last, pad);

return 0;
}

Expand Down

0 comments on commit 1bb97c4

Please sign in to comment.