net/mptcp/pm_netlink.c:98:22: warning: The scope of the variable 'skc' can be reduced. [variableScope]

From: kbuild test robot
Date: Sun Apr 05 2020 - 06:41:30 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4c205c84e249e0a91dcfabe461d77667ec9b2d05
commit: 01cacb00b35cb62b139f07d5f84bcf0eeda8eff6 mptcp: add netlink-based PM
date: 6 days ago

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>


cppcheck warnings: (new ones prefixed by >>)

>> net/mptcp/pm_netlink.c:98:22: warning: The scope of the variable 'skc' can be reduced. [variableScope]
>> struct sock_common *skc;
^

vim +/skc +98 net/mptcp/pm_netlink.c

92
93 static bool lookup_subflow_by_saddr(const struct list_head *list,
94 struct mptcp_addr_info *saddr)
95 {
96 struct mptcp_subflow_context *subflow;
97 struct mptcp_addr_info cur;
> 98 struct sock_common *skc;
99
100 list_for_each_entry(subflow, list, node) {
101 skc = (struct sock_common *)mptcp_subflow_tcp_sock(subflow);
102
103 local_address(skc, &cur);
104 if (addresses_equal(&cur, saddr, false))
105 return true;
106 }
107
108 return false;
109 }
110

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx