Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp308875pxm; Wed, 2 Mar 2022 16:02:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/NOTcr5aCoiy/Fjz/8Uldym+ayqfwP/3wJjx9O8DsMcHwj1EO0yFgQh/N3xN2IPjodogb X-Received: by 2002:a17:902:aa86:b0:150:25f4:f43d with SMTP id d6-20020a170902aa8600b0015025f4f43dmr29112906plr.141.1646265731215; Wed, 02 Mar 2022 16:02:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646265731; cv=none; d=google.com; s=arc-20160816; b=XzgaXJdnhvRh635EuFQ2oDzvkS4m/1y6pmxZi0KvJY1HL7N1FVszeYEEaYJPI0aq9z 1Zd5297PZ6sXJuCTdbW1zhN1dYgWjcdJTd0kN+D28OPo5HAn9y0aCn5eyVCOVtBquSPO u8eTc3lTF0F6Zprt9Y4Jq5507nDraYVv/zri6dDucKc7GebMjRTdwSEAGJBqlfcxmNoC YVXGBjfgyHoQvNvSfVMdjPy/84TSxnAIPS2HXSa3JYzl83P4+4A20lEqPpUy+ksTnkID q56w/jVgSOip2JC7fnCZgDY8g7sz5W/dhxZgYp0xVeEi7iy9WT0kFQ0K/xRYS7EvFYkk yJ8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ePWS8huBNB8mOLwzP5l9zhhnqwr/R2aV/N6dfRb+pkA=; b=ES2OLvWjuG/1NGgxVeppz1kbW4xcLsyhluuT1nPrBmknHRYCXJHZnogXAxVYbX0AHE 2mCSL7CKomaDwP7N3JavKZ5LO77+mi31BylDNm2HDih8YQg4Gz1/RGykIljm105MCdrd nmMZ6+/TYQwSFqBLAD/ToqsZcjdy2vA/N8hadGUd2DL5dWWfIyLkTP57MdXkhUMPQ1Ys Egj+7J+a/mEA4ht1hBA39Yu6KviYxP1nA+lhA60jBqqPNtiqMCJW2j/Qhwv6IW9BMcxT QttUHs1exUDdZNJ15q+AdUnitZ/ZcVNAJ7pXVgLXRjDYzbnbNG/PgzHRE/Yij0aKjATs QK0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=OqDB+l+J; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a38-20020a634d26000000b0036fb8de31b3si456698pgb.678.2022.03.02.16.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 16:02:11 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=OqDB+l+J; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ECBC11986DD; Wed, 2 Mar 2022 15:20:43 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239919AbiCBT0Y (ORCPT + 99 others); Wed, 2 Mar 2022 14:26:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238923AbiCBT0Q (ORCPT ); Wed, 2 Mar 2022 14:26:16 -0500 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32C3CC12CA for ; Wed, 2 Mar 2022 11:25:32 -0800 (PST) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 8376A3F5F2 for ; Wed, 2 Mar 2022 19:25:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646249130; bh=ePWS8huBNB8mOLwzP5l9zhhnqwr/R2aV/N6dfRb+pkA=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OqDB+l+JRV4MPEmDj4lf32cqG+Pt9SxR6kg7Ds+fid5NhbPhKD2YmaOcgycudK/jb AHMMF+l7d1/ic2htSTd8NfnotJGKiyLYH5GDXu29JSrNsoJxIEbaW5IbfoHoQ08+s0 Iw+ZvwLnEijCMPmyuSp6qyXE6dsBNVsrxCiCNUCd+EseiO9/b491j39JmkA7ohEmp8 y2XvzR+0ebxKudBRT87KoIvZD3RAgT9Bz7LEXfwoUsTfP+OKVVV+T4brfWKceAsdIT ROCqOZOebBsUTko+zdZ3rEymQl8VUdMsw3qZtnuK0Tw1sBHFX8S/9bQww2u/5bk5Z3 2XiDAZLP9bk5w== Received: by mail-ed1-f69.google.com with SMTP id s7-20020a508dc7000000b0040f29ccd65aso1554307edh.1 for ; Wed, 02 Mar 2022 11:25:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ePWS8huBNB8mOLwzP5l9zhhnqwr/R2aV/N6dfRb+pkA=; b=GHJKLFdKZjVxHQS/zGSbeaSrVdo4ZW/KfXP0r9tznb1VIgVNqOhsMJzZtDJOXDtZTl uRbPQXVvRlwSck6biR8c/KAe+NfT6hoOdKjmSxdKuB7F+cpf6JuDe9GIvFMooz/mtHk3 NbMToVTC7sKfSw3TOpo2QyHaxFIe7t4Jsd1jqNVacKLYSo5TZ2F+QSwL73RWINbHoSYh kMizZptRSE7qZQj10lFy1Ooz0ffPjtMmvH3GMZ2mLGQ7Hhb9CZI3X4yKq6G04Dlu55F4 NVKsSeb1xB+0c4TqeSdhGrE+xHjpS/NjDSXIl2I/v3AJ5LsczRpTfoICcCJYiSwBKf+S 7r+A== X-Gm-Message-State: AOAM533fwMdlaxhZfomYTmwigBdKQZH7Ghg8vgW8Np1jeImIJWJljtsL VFJWsWcShrXi+Z21/2tIOEySzv3WzHtF139aOexY0Rc/IFUuHh6meiwYkyKYIXPImXNpFimwaA4 vpu3SH/Oe+oeatFMv/F2ZPH36iemZt3ffPse22vvS9Q== X-Received: by 2002:aa7:d706:0:b0:415:a00b:4ee with SMTP id t6-20020aa7d706000000b00415a00b04eemr7325276edq.373.1646249129876; Wed, 02 Mar 2022 11:25:29 -0800 (PST) X-Received: by 2002:aa7:d706:0:b0:415:a00b:4ee with SMTP id t6-20020aa7d706000000b00415a00b04eemr7325252edq.373.1646249129662; Wed, 02 Mar 2022 11:25:29 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-181-108.adslplus.ch. [188.155.181.108]) by smtp.gmail.com with ESMTPSA id i14-20020a50cfce000000b00415b0730921sm1482765edk.42.2022.03.02.11.25.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 11:25:28 -0800 (PST) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH v2 2/6] nfc: llcp: simplify llcp_sock_connect() error paths Date: Wed, 2 Mar 2022 20:25:19 +0100 Message-Id: <20220302192523.57444-3-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220302192523.57444-1-krzysztof.kozlowski@canonical.com> References: <20220302192523.57444-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The llcp_sock_connect() error paths were using a mixed way of central exit (goto) and cleanup Signed-off-by: Krzysztof Kozlowski --- net/nfc/llcp_sock.c | 8 ++++---- 1 file 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 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, 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: -- 2.32.0