From patchwork Wed Oct 7 15:54:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 11820905 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 829E6618 for ; Wed, 7 Oct 2020 16:03:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B93A216C4 for ; Wed, 7 Oct 2020 16:03:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729020AbgJGQDu (ORCPT ); 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-Language: en-US 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); }