diff mbox series

[next-next,2/2] net: vlan: reduce indentation level in __vlan_find_dev_deep_rcu()

Message ID 917c41381e1155eefe84c610585c487d8073166f.1661916732.git.william.xuanziyang@huawei.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series net: vlan: two small refactors to make code more concise | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 5 this patch: 5
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 2 this patch: 2
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 32 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ziyang Xuan (William) Aug. 31, 2022, 4:09 a.m. UTC
If vlan_info is NULL in __vlan_find_dev_deep_rcu(), else { ... } is
unnecessary. Remove it to reduce indentation level.

Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
---
 net/8021q/vlan_core.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 5aa8144101dc..027d4ebed9c0 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -77,23 +77,19 @@  struct net_device *__vlan_find_dev_deep_rcu(struct net_device *dev,
 					__be16 vlan_proto, u16 vlan_id)
 {
 	struct vlan_info *vlan_info = rcu_dereference(dev->vlan_info);
+	struct net_device *upper_dev;
 
-	if (vlan_info) {
+	if (vlan_info)
 		return vlan_group_get_device(&vlan_info->grp,
 					     vlan_proto, vlan_id);
-	} else {
-		/*
-		 * Lower devices of master uppers (bonding, team) do not have
-		 * grp assigned to themselves. Grp is assigned to upper device
-		 * instead.
-		 */
-		struct net_device *upper_dev;
 
-		upper_dev = netdev_master_upper_dev_get_rcu(dev);
-		if (upper_dev)
-			return __vlan_find_dev_deep_rcu(upper_dev,
-						    vlan_proto, vlan_id);
-	}
+	/* Lower devices of master uppers (bonding, team) do not have
+	 * grp assigned to themselves. Grp is assigned to upper device
+	 * instead.
+	 */
+	upper_dev = netdev_master_upper_dev_get_rcu(dev);
+	if (upper_dev)
+		return __vlan_find_dev_deep_rcu(upper_dev, vlan_proto, vlan_id);
 
 	return NULL;
 }