Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp424440lqo; Fri, 10 May 2024 04:20:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVggIsLCAxLxk7MrlDDD8lsKgf5Rc1ZjdllNW7MQfTwixZeWZnBeXOK1p2LZmdUPfjgZdPFHnd+Mq+uPXanrOySoh9yoQME8SLp58+6uA== X-Google-Smtp-Source: AGHT+IEMYjajjTVGaG3pEOoRcAuLI+QcnkaIyrz+Sb9FYVx3v7udavvrasbz3NX92qXsZhmlg92b X-Received: by 2002:a05:6a21:328e:b0:1af:d044:1395 with SMTP id adf61e73a8af0-1afde0b0c18mr2747145637.20.1715340050307; Fri, 10 May 2024 04:20:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715340050; cv=pass; d=google.com; s=arc-20160816; b=bpKoNxV1z7Q0t3F/iOO+WzwBxmc6WkFkZTtbLXn7dqYaymv5CyLcr6v7PeNBNc9khu 8buA4iBENY+G+wi6v1qsQGvqOk/K+BpasEf8PpOAse2ChW0fWuqiYbQ+E7PKGU6/9Vw/ BKjMoprP9C3gwdI+TOfPB3EvW4aHsX80zQQfkOgWsr2d79NmrX39fkWwVpx56IuRwknW p7Q48M9ZWofUwE3IN6kHN2o8VPYPDhAjheh8lRxZHuM5UQEcXNfv2RGC53f0UpoDSomH 23aAhVuAHf3SsZNpkJ3mVRUX9cHzh1D+rHe8XB5QF/tZ7Tyff61P2MqKIFThbzk/CVlU ucNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=xC04jzUAKKuNz/sBo6YHpfftVQntnFukhIFGhTvSnns=; fh=quEeNqdtSTihk0Sjr9Tsd/2OdzTTR5adQM8Csz/bJ2A=; b=eMUAjjzQn7BIn9a12zDYryQv3Jb7mi5IZwdF9D55RR2TDoU8PEmXYGDDVpN+eXeN3o x+Efn26abXT0b5eFCKYMGzMcFNBsmYzzBDiZxYe35qS/TN4EnBpkQrq+1SJ7cV2s7MuQ zBayE8TrB4vsSrcoppMDn5RxKNq5p0OJUJLXQ3j9LtQrE6RlfEvovA8mv87+KT84O5oJ SFDnZAPa1BmYGt0/b2MxoCnSl9cIvkRlQiK4O4TcDoOR2Zng8oERQv7nLlJi9evF4VJJ lTo11fArVQ4uWlnv0TLaeBLsCh7O8auzvnYWBOPR39mBP7ews/omtKSpeuas8QgYoMPl 1ytA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EZ33SQKl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-175642-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175642-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c368a08si34663845ad.630.2024.05.10.04.20.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 04:20:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175642-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EZ33SQKl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-175642-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175642-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 32CF7B20CB2 for ; Fri, 10 May 2024 11:20:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 83F78171092; Fri, 10 May 2024 11:19:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EZ33SQKl" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A487F16EC18; Fri, 10 May 2024 11:19:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715339952; cv=none; b=QlFor8sQDrVCXK3pYd/z8FglNUZZQcUlJIdZGbomYF38OLC9i2FDrJgb+G1ZaK7iE7gN5aWnSKQx9XJyGgAXbZ6ZWAnukbxJsgygnq7CbNlulxVgqjXUMGr7KucJsURTNom25WIlcme53+NlblnXlHYoURO0Oy5NzMqo12TkuZc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715339952; c=relaxed/simple; bh=g9/Ts3HF1r1iy03o7GZp55OQrzTi5Lbtpm9Z2O40MPo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OtCDafUEYwVAsE9KKUI006kMUPA9pw8L6V/0RWJncVLmpkrBKL9yacOG+yqCWZ9Vx/2ECCDidUCWMgq+PYe4bXhvJ60rjWPd7XViUkUIwWYZNixmSUfDWD+p8IJsSk0UJ17C7V1et+P0NGf58NLoxWTMWlN8SBojV4jue1+xZYs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EZ33SQKl; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1F6AC32781; Fri, 10 May 2024 11:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715339952; bh=g9/Ts3HF1r1iy03o7GZp55OQrzTi5Lbtpm9Z2O40MPo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EZ33SQKl6dO4lEs6fb7iiaz/O9behXw9uxJnd/Z4FSo7rxX0Gp0TYgyc9HrLD6/7G zp2TfgdWpo5FtBENqnYp6Z253uQ5MNdvKSdKUyHIJ85zhb6pbdnnVAK1q27X2tUznZ wxs2Y77mdrtldgycA3ecAg5k8DzDDImEYYcvd9skhHTzvASpuSbnWEmcxzgQjjgZtw WOerD8yEPZsQrfNN44+y0GDY06Uw/abVHy65ByUfjaPaelbtX1+ElKExb3hYqr9mma 2bpwFzWDNthjnqTM/EY6isKKM6XoV0XLyE4soNVLYnh69IDn2XAOM/9nEMuPhhy4Yi H9C3z4b1ENiBA== From: "Matthieu Baerts (NGI0)" Date: Fri, 10 May 2024 13:18:36 +0200 Subject: [PATCH net-next 6/8] mptcp: remove unnecessary else statements Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240510-upstream-net-next-20240509-misc-improvements-v1-6-4f25579e62ba@kernel.org> References: <20240510-upstream-net-next-20240509-misc-improvements-v1-0-4f25579e62ba@kernel.org> In-Reply-To: <20240510-upstream-net-next-20240509-misc-improvements-v1-0-4f25579e62ba@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Westphal Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2132; i=matttbe@kernel.org; h=from:subject:message-id; bh=g9/Ts3HF1r1iy03o7GZp55OQrzTi5Lbtpm9Z2O40MPo=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmPgKc1QcUYvndAnUHnijSXy1AReoYUZFJh7zL7 cPPQACSYUuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZj4CnAAKCRD2t4JPQmmg czGoEAC3r8/aL+IMbek1lKsHeROt/gjlk3DFA3X53eSEsJNgKdA3tgXY2KippKQf7yOq106iXas WE0j6JyTXyKUtYxiWDkQfmzm4PDjazz1Tb3EDANRklWYcvsy/1ky8nfDgIQ6dG/+ijta49QkyF2 lNpP8UP9YZwGsMdUUlCQHamw7I81WUfWKYuGkiZuxWcAjdkV/9uG95OllFS70T10BdJjWibfSAP di8MHq/Ac5MxkABxmGWdlQ+JFM5VbOI9sJHbfwI0S3vEyrps8gvQaLzBQ0kVpiwIBvZM3vRmI5B DNQXoBi4csk4umXWC0ZoUMZ1y0sCbPCpc9cyrPw6XgcZExIXDpta6u84muR2ChA+EqJqYwkwRGQ OLs86zrz47yqSdNQelbx7eDo3FzTtNtBUQeMSwkzs9wMQA1qHRHgGVZ64FRzuGrrWwOQ/55HPk9 1+nTi1PLbZ8hCtoboYNBNk0lnN8LtTmMdEXeeUnZr55A4ZXOS2wC6M269RlNtETM54SxAwIpN3v X5wr+KWco/xxDgVW+rJw4ONMNOgf2C/LZi0zAxZukZ/KNEVTW1zksaBa2XQgFPzLPzc9FAOlLzT ZfMYFvT2u9U2yE3gGJUtwunro7ODYodNIx7foNNmgkgLrduMz3GKcQzUqylty+L940CzV9cUL5d VpveFJz48U78SAQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 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 Reviewed-by: Geliang Tang Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/subflow.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index c1d13e555d10..612c38570a64 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1119,6 +1119,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); @@ -1131,26 +1133,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--; } -- 2.43.0