Skip to content

Commit

Permalink
mptcp: remove unnecessary else statements
Browse files Browse the repository at this point in the history
The 'else' statements are not needed here, because their previous 'if'
block ends with a 'return'.

This fixes CheckPatch warnings:

  WARNING: else is not generally useful after a break or return

Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
  • Loading branch information
matttbe authored and intel-lab-lkp committed May 2, 2024
1 parent 001334b commit 35daae9
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,8 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
}

if (mpext->data_fin == 1) {
u64 data_fin_seq;

if (data_len == 1) {
bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq,
mpext->dsn64);
Expand All @@ -1129,26 +1131,26 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
*/
skb_ext_del(skb, SKB_EXT_MPTCP);
return MAPPING_OK;
} else {
if (updated)
mptcp_schedule_work((struct sock *)msk);

return MAPPING_DATA_FIN;
}
} else {
u64 data_fin_seq = mpext->data_seq + data_len - 1;

/* If mpext->data_seq is a 32-bit value, data_fin_seq
* must also be limited to 32 bits.
*/
if (!mpext->dsn64)
data_fin_seq &= GENMASK_ULL(31, 0);
if (updated)
mptcp_schedule_work((struct sock *)msk);

mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64);
pr_debug("DATA_FIN with mapping seq=%llu dsn64=%d",
data_fin_seq, mpext->dsn64);
return MAPPING_DATA_FIN;
}

data_fin_seq = mpext->data_seq + data_len - 1;

/* If mpext->data_seq is a 32-bit value, data_fin_seq must also
* be limited to 32 bits.
*/
if (!mpext->dsn64)
data_fin_seq &= GENMASK_ULL(31, 0);

mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64);
pr_debug("DATA_FIN with mapping seq=%llu dsn64=%d",
data_fin_seq, mpext->dsn64);

/* Adjust for DATA_FIN using 1 byte of sequence space */
data_len--;
}
Expand Down

0 comments on commit 35daae9

Please sign in to comment.