Skip to content

Commit d07f865

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
mptcp: drop info of userspace_pm_remove_id_zero_address
The only use of 'info' parameter of userspace_pm_remove_id_zero_address() is to set an error message into it. Plus, this helper will only fail when it cannot find any subflows with a local address ID 0. This patch drops this parameter and sets the error message where this function is called in mptcp_pm_nl_remove_doit(). Signed-off-by: Geliang Tang <[email protected]>
1 parent 3c79ee8 commit d07f865

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

net/mptcp/pm_userspace.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,7 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info)
253253
return err;
254254
}
255255

256-
static int mptcp_userspace_pm_remove_id_zero_address(struct mptcp_sock *msk,
257-
struct genl_info *info)
256+
static int mptcp_userspace_pm_remove_id_zero_address(struct mptcp_sock *msk)
258257
{
259258
struct mptcp_rm_list list = { .nr = 0 };
260259
struct mptcp_subflow_context *subflow;
@@ -269,10 +268,8 @@ static int mptcp_userspace_pm_remove_id_zero_address(struct mptcp_sock *msk,
269268
break;
270269
}
271270
}
272-
if (!has_id_0) {
273-
GENL_SET_ERR_MSG(info, "address with id 0 not found");
271+
if (!has_id_0)
274272
goto remove_err;
275-
}
276273

277274
list.ids[list.nr++] = 0;
278275

@@ -330,7 +327,7 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info)
330327
sk = (struct sock *)msk;
331328

332329
if (id_val == 0) {
333-
err = mptcp_userspace_pm_remove_id_zero_address(msk, info);
330+
err = mptcp_userspace_pm_remove_id_zero_address(msk);
334331
goto out;
335332
}
336333

@@ -339,7 +336,6 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info)
339336
spin_lock_bh(&msk->pm.lock);
340337
match = mptcp_userspace_pm_lookup_addr_by_id(msk, id_val);
341338
if (!match) {
342-
GENL_SET_ERR_MSG(info, "address with specified id not found");
343339
spin_unlock_bh(&msk->pm.lock);
344340
release_sock(sk);
345341
goto out;
@@ -356,6 +352,11 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info)
356352

357353
err = 0;
358354
out:
355+
if (err)
356+
GENL_SET_ERR_MSG_FMT(info,
357+
"address with id %u not found",
358+
id_val);
359+
359360
sock_put(sk);
360361
return err;
361362
}

0 commit comments

Comments
 (0)