Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp538265pxu; Wed, 7 Oct 2020 09:22:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/5s71d6+o3SmA6hx8IJVVN92Q+Ow4UydYvojtAif/6PlEqHG2J80LRXvtflnruEZQZ7OT X-Received: by 2002:a17:906:cc53:: with SMTP id mm19mr4125227ejb.514.1602087720114; Wed, 07 Oct 2020 09:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602087720; cv=none; d=google.com; s=arc-20160816; b=TPK3SuG/3HQDbz1JKVa8snk3Xy+/AO68OYEd2Vu8oXoHTZ33Ztu6QPwJ3wxuUq6YHx M9OFKeOLTVQQoFeEeeGCLR067GRJ27Y0ErO1nq9byHhVurlD8Y9B1t5eYuqYfNOiq/Cx v1ekfNtXvbNuucq/a0y+FgujCmwEQVXqpA2xt9z+2x1kNqCWJQGzK97r0VH4pefQZRtZ R9ob7Ct/75qyoO1SpXYcDR7Iy1DK+8B4myijzME8xN7X9cRFFGrYLiuXDV+loPLbD1RX AAcM8ihvVqAYg/RG+uI/YucDEH50hILqQKaO1F9oJQswXLHshZrV/AiU+fXORCXX3Uju EzIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :references:cc:to:from:subject:dkim-filter; bh=L7YYid8LfSzCLsEkNsixKXMcw2q1XWbRIQ3Rc2tlVrU=; b=Fodo3ggLLsBsPZ48lnMPLFEmQEQb3rmjCug0+sxnzHN8jB6Ue8g6Owxbm3If0MV0lU WkmCW05SNEo3P2qnYIB4QVLSDjpdJiofuyvnChsTxMbYIxkAJCL4F95qXrDzI6UEbF/v rzYG1dHxGGGMMpymW74hK57tHA6a18nC5BFVSozb6MTttaFJYIwixJEW7GAMwIC7Tkbz IUVP5b8YuvO4U0RrRKHELPR+S2hp3/A+QR1OttfloFxAa94sYrzVSNJc26KFCMYIIOp1 /H9YdVmJSobum6IyTkayvjqB369o01b9rYXyrXIDBPM8PFQfNz50kMrr4lo3Ev5Xzgws e3Mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=omprussia.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si2249737ejx.541.2020.10.07.09.21.02; Wed, 07 Oct 2020 09:22:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=omprussia.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728995AbgJGQDu (ORCPT + 99 others); Wed, 7 Oct 2020 12:03:50 -0400 Received: from mxout03.lancloud.ru ([89.108.73.187]:39426 "EHLO mxout03.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728503AbgJGQDu (ORCPT ); Wed, 7 Oct 2020 12:03:50 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru BEBF82092EC1 Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: [PATCH 1/2] bluetooth: hci_event: consolidate error paths in hci_phy_link_complete_evt() From: Sergey Shtylyov To: Marcel Holtmann , Johan Hedberg , CC: "David S. Miller" , Jakub Kicinski , References: Organization: Open Mobile Platform, LLC Message-ID: Date: Wed, 7 Oct 2020 18:54:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [213.87.153.155] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1908.lancloud.ru (fd00:f066::208) Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org hci_phy_link_complete_evt() has several duplicate error paths -- consolidate them, using the *goto* statements. Signed-off-by: Sergey Shtylyov --- net/bluetooth/hci_event.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) Index: bluetooth-next/net/bluetooth/hci_event.c =================================================================== --- bluetooth-next.orig/net/bluetooth/hci_event.c +++ bluetooth-next/net/bluetooth/hci_event.c @@ -4936,20 +4936,15 @@ static void hci_phy_link_complete_evt(st hci_dev_lock(hdev); hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); - if (!hcon) { - hci_dev_unlock(hdev); - return; - } + if (!hcon) + goto unlock; - if (!hcon->amp_mgr) { - hci_dev_unlock(hdev); - return; - } + if (!hcon->amp_mgr) + goto unlock; if (ev->status) { hci_conn_del(hcon); - hci_dev_unlock(hdev); - return; + goto unlock; } bredr_hcon = hcon->amp_mgr->l2cap_conn->hcon; @@ -4966,6 +4961,7 @@ static void hci_phy_link_complete_evt(st amp_physical_cfm(bredr_hcon, hcon); +unlock: hci_dev_unlock(hdev); }