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

2020-10-03 Thread Xie He
On Sat, Oct 3, 2020 at 11:10 AM Stephen Hemminger wrote: > > 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? Oh! Yes! I looked at the skb_pad function and I think we can use it in this code. Since it doesn't do s

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

2020-10-03 Thread Stephen Hemminger
On Sat, 3 Oct 2020 10:35:28 -0700 Xie He 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)

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

2020-10-03 Thread Xie He
1. Keep the code for the normal (non-error) flow at the lowest indentation level. This reduces indentation and makes the code feels more natural to read. 2. Use "goto drop" for all error handling. This reduces duplicate code. 3. Change "dev_kfree_skb" to "kfree_skb" in error handling code. "kfree