diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2020-01-05 18:36:07 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-01-06 13:39:35 -0800 |
commit | b289ba5e07105548b8219695e5443d807a825eb8 (patch) | |
tree | d498ed45793c1c24b2afade999da4fe10121fd82 /drivers/net/gtp.c | |
parent | f233789dfcd4b1e08fac86645c31932f88b291bb (diff) |
gtp: simplify error handling code in 'gtp_encap_enable()'
'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: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gtp.c')
-rw-r--r-- | drivers/net/gtp.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index fca471e27f39..dea3978b223c 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -851,8 +851,7 @@ 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); + gtp_encap_disable_sock(sk0); return PTR_ERR(sk1u); } } @@ -860,10 +859,8 @@ 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); + gtp_encap_disable_sock(sk0); + gtp_encap_disable_sock(sk1u); return -EINVAL; } } |