]> git.baikalelectronics.ru Git - kernel.git/commit
net: hdlc_fr: Change the use of "dev" in fr_rx to make the code cleaner
authorXie He <xie.he.0141@gmail.com>
Sat, 31 Oct 2020 18:10:40 +0000 (11:10 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 3 Nov 2020 23:19:09 +0000 (15:19 -0800)
commite00a0b5ddbd167c014716848819ab105932de72f
treeca741585909aef15fb4cce98f29e6e9750ed4916
parenta645ff8a099e84938f805c630feab1232a4e3ae3
net: hdlc_fr: Change the use of "dev" in fr_rx to make the code cleaner

The eth_type_trans function is called when we receive frames carrying
Ethernet frames. This function expects a non-NULL pointer as an argument,
and assigns it directly to skb->dev.

However, the code handling other types of frames first assigns the pointer
to "dev", and then at the end checks whether the value is NULL, and if it
is not NULL, assigns it to skb->dev.

The two flows are different. Mixing them in this function makes the code
messy. It's better that we convert the second flow to align with how
eth_type_trans does things.

So this patch changes the code to: first make sure the pointer is not
NULL, then assign it directly to skb->dev. "dev" is no longer needed until
the end where we use it to update stats.

Cc: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/wan/hdlc_fr.c