Skip to contentSkip to conversation

mptcp: remove redundant initialization in pm_nl_init_net()

PATCH Superseded Jianguo Wu 1 participant 1 message Apr 22, 2021

Subsystems (2)
lore
Share & tools
lore

Jianguo Wu

author
#0 lore raw

PATCH v2 1/1 mptcp: remove redundant initialization in pm_nl_init_net()

From: wujianguo <[email protected]>

Memory of struct pm_nl_pernet{} is allocated by kzalloc() in setup_net()->ops_init(), so it's no need to reset counters and zero bitmap in pm_nl_init_net().

---
 net/mptcp/pm_netlink.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/mptcp/pm_netlink.c +4 -2
index 6ba0408..becc32b 100644
@@ -1913,10 +1913,12 @@ static int __net_init pm_nl_init_net(struct net *net)
 	struct pm_nl_pernet *pernet = net_generic(net, pm_nl_pernet_id);
 
 	INIT_LIST_HEAD_RCU(&pernet->local_addr_list);
-	__reset_counters(pernet);
 	pernet->next_id = 1;
-	bitmap_zero(pernet->id_bitmap, MAX_ADDR_ID + 1);
 	spin_lock_init(&pernet->lock);
+
+	/* No need to initialize other flieds of pernet, as all fields
+	 * are already initialized to 0 at allocation time.
+	 */
 	return 0;
 }
 
Signature · 1 line
1.8.3.1