Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f6907bf authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Greg Kroah-Hartman
Browse files

gtp: simplify error handling code in 'gtp_encap_enable()'



[ Upstream commit b289ba5e07105548b8219695e5443d807a825eb8 ]

'gtp_encap_disable_sock(sk)' handles the case where sk is NULL, so there
is no need to test it before calling the function.

This saves a few line of code.

Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Stable-dep-of: 7515e37bce5c ("gtp: allow -1 to be specified as file description from userspace")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent c593895b
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -860,7 +860,6 @@ static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[])

		sk1u = gtp_encap_enable_socket(fd1, UDP_ENCAP_GTP1U, gtp);
		if (IS_ERR(sk1u)) {
			if (sk0)
			gtp_encap_disable_sock(sk0);
			return PTR_ERR(sk1u);
		}
@@ -869,9 +868,7 @@ static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[])
	if (data[IFLA_GTP_ROLE]) {
		role = nla_get_u32(data[IFLA_GTP_ROLE]);
		if (role > GTP_ROLE_SGSN) {
			if (sk0)
			gtp_encap_disable_sock(sk0);
			if (sk1u)
			gtp_encap_disable_sock(sk1u);
			return -EINVAL;
		}