Re: [PATCH net-next] drivers/net/wan/hdlc_fr: Reduce indentation in pvc_xmit

From: Stephen Hemminger
Date: Sat Oct 03 2020 - 14:10:16 EST


On Sat, 3 Oct 2020 10:35:28 -0700
Xie He <xie.he.0141@xxxxxxxxx> wrote:

> + if (dev->type == ARPHRD_ETHER) {
> + int pad = ETH_ZLEN - skb->len;
> +
> + if (pad > 0) { /* Pad the frame with zeros */
> + int len = skb->len;
> +
> + if (skb_tailroom(skb) < pad)
> + if (pskb_expand_head(skb, 0, pad, GFP_ATOMIC))
> + goto drop;
> + skb_put(skb, pad);
> + memset(skb->data + len, 0, pad);
> }
> }

This code snippet is basically an version of skb_pad().
Probably it is very old and pre-dates that.
Could the code use skb_pad?