linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omprussia.ru>
To: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	<linux-bluetooth@vger.kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, <netdev@vger.kernel.org>
Subject: [PATCH 1/2] bluetooth: hci_event: consolidate error paths in hci_phy_link_complete_evt()
Date: Wed, 7 Oct 2020 18:54:15 +0300	[thread overview]
Message-ID: <b508265e-f08f-ea24-2815-bc2a5ec10d8d@omprussia.ru> (raw)
In-Reply-To: <bbdd9cbe-b65e-b309-1188-71a3a4ca6fdc@omprussia.ru>

hci_phy_link_complete_evt() has several duplicate error paths -- consolidate
them, using the *goto* statements.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>

---
 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);
 }
 

  reply	other threads:[~2020-10-07 16:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 15:52 [PATCH 0/2] bluetooth: hci_event: make coding style more consistent Sergey Shtylyov
2020-10-07 15:54 ` Sergey Shtylyov [this message]
2020-11-11 11:12   ` [PATCH 1/2] bluetooth: hci_event: consolidate error paths in hci_phy_link_complete_evt() Marcel Holtmann
2020-11-12  9:02     ` Sergey Shtylyov
2020-11-23 11:58       ` Marcel Holtmann
2021-01-23 17:47         ` Sergey Shtylyov
2020-10-07 15:55 ` [PATCH 2/2] bluetooth: hci_event: reduce indentation levels Sergey Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b508265e-f08f-ea24-2815-bc2a5ec10d8d@omprussia.ru \
    --to=s.shtylyov@omprussia.ru \
    --cc=davem@davemloft.net \
    --cc=johan.hedberg@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).