summaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp_sock.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>2022-03-02 20:25:19 +0100
committerDavid S. Miller <davem@davemloft.net>2022-03-03 11:43:37 +0100
commitec10fd154d934cc4195da3cbd017a12817b41d51 (patch)
tree5f6182066c4520e257c612b81676f05ff9d73b78 /net/nfc/llcp_sock.c
parentnfc: llcp: nullify llcp_sock->dev on connect() error paths (diff)
downloadlinux-ec10fd154d934cc4195da3cbd017a12817b41d51.tar.xz
linux-ec10fd154d934cc4195da3cbd017a12817b41d51.zip
nfc: llcp: simplify llcp_sock_connect() error paths
The llcp_sock_connect() error paths were using a mixed way of central exit (goto) and cleanup Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--net/nfc/llcp_sock.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index e92440c0c4c7..fdf0856182c6 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -712,10 +712,8 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
llcp_sock->local = nfc_llcp_local_get(local);
llcp_sock->ssap = nfc_llcp_get_local_ssap(local);
if (llcp_sock->ssap == LLCP_SAP_MAX) {
- nfc_llcp_local_put(llcp_sock->local);
- llcp_sock->local = NULL;
ret = -ENOMEM;
- goto put_dev;
+ goto sock_llcp_put_local;
}
llcp_sock->reserved_ssap = llcp_sock->ssap;
@@ -760,11 +758,13 @@ sock_unlink:
sock_llcp_release:
nfc_llcp_put_ssap(local, llcp_sock->ssap);
+
+sock_llcp_put_local:
nfc_llcp_local_put(llcp_sock->local);
llcp_sock->local = NULL;
+ llcp_sock->dev = NULL;
put_dev:
- llcp_sock->dev = NULL;
nfc_put_device(dev);
error: