Skip to content

Commit 96a92e9

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
mptcp: drop match in userspace_pm_append_new_local_addr
The variable 'match' in mptcp_userspace_pm_append_new_local_addr() is a redundant one, and this patch drops it. No need to define 'match' as 'struct mptcp_pm_addr_entry *' type. In this function, it's only used to check whether it's NULL. It can be defined as a Boolean one. Also other variables 'addr_match' and 'id_match' make 'match' a redundant one, which can be replaced by directly checking 'addr_match && id_match'. Signed-off-by: Geliang Tang <[email protected]>
1 parent e985901 commit 96a92e9

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

net/mptcp/pm_userspace.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
4848
bool needs_id)
4949
{
5050
struct mptcp_pm_addr_id_bitmap id_bitmap;
51-
struct mptcp_pm_addr_entry *match = NULL;
5251
struct sock *sk = (struct sock *)msk;
5352
struct mptcp_pm_addr_entry *e;
5453
bool addr_match = false;
@@ -63,16 +62,12 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
6362
if (addr_match && entry->addr.id == 0 && needs_id)
6463
entry->addr.id = e->addr.id;
6564
id_match = (e->addr.id == entry->addr.id);
66-
if (addr_match && id_match) {
67-
match = e;
65+
if (addr_match || id_match)
6866
break;
69-
} else if (addr_match || id_match) {
70-
break;
71-
}
7267
__set_bit(e->addr.id, id_bitmap.map);
7368
}
7469

75-
if (!match && !addr_match && !id_match) {
70+
if (!addr_match && !id_match) {
7671
/* Memory for the entry is allocated from the
7772
* sock option buffer.
7873
*/
@@ -90,7 +85,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
9085
list_add_tail_rcu(&e->list, &msk->pm.userspace_pm_local_addr_list);
9186
msk->pm.local_addr_used++;
9287
ret = e->addr.id;
93-
} else if (match) {
88+
} else if (addr_match && id_match) {
9489
ret = entry->addr.id;
9590
}
9691

0 commit comments

Comments
 (0)