linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Mullen <omaolaip@tcd.ie>
To: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: [PATCH BlueZ 2/3] policy: Avoid using UUID if field is not set
Date: Fri, 16 Oct 2020 15:09:37 -0700	[thread overview]
Message-ID: <b8547b16-60b8-766a-6e63-ae96bead9f0c@tcd.ie> (raw)

---
  plugins/policy.c | 26 ++++++++++++++------------
  1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/plugins/policy.c b/plugins/policy.c
index dac1b7a24..e156c0db2 100644
--- a/plugins/policy.c
+++ b/plugins/policy.c
@@ -635,17 +635,19 @@ static void service_cb(struct btd_service *service,
  	struct btd_profile *profile = btd_service_get_profile(service);
  	struct reconnect_data *reconnect;
  -	if (g_str_equal(profile->remote_uuid, A2DP_SINK_UUID))
-		sink_cb(service, old_state, new_state);
-	else if (g_str_equal(profile->remote_uuid, A2DP_SOURCE_UUID))
-		source_cb(service, old_state, new_state);
-	else if (g_str_equal(profile->remote_uuid, AVRCP_REMOTE_UUID))
-		controller_cb(service, old_state, new_state);
-	else if (g_str_equal(profile->remote_uuid, AVRCP_TARGET_UUID))
-		target_cb(service, old_state, new_state);
-	else if (g_str_equal(profile->remote_uuid, HFP_HS_UUID) ||
-			g_str_equal(profile->remote_uuid, HSP_HS_UUID))
-		hs_cb(service, old_state, new_state);
+	if (profile->remote_uuid) {
+		if (g_str_equal(profile->remote_uuid, A2DP_SINK_UUID))
+			sink_cb(service, old_state, new_state);
+		else if (g_str_equal(profile->remote_uuid, A2DP_SOURCE_UUID))
+			source_cb(service, old_state, new_state);
+		else if (g_str_equal(profile->remote_uuid, AVRCP_REMOTE_UUID))
+			controller_cb(service, old_state, new_state);
+		else if (g_str_equal(profile->remote_uuid, AVRCP_TARGET_UUID))
+			target_cb(service, old_state, new_state);
+		else if (g_str_equal(profile->remote_uuid, HFP_HS_UUID) ||
+				g_str_equal(profile->remote_uuid, HSP_HS_UUID))
+			hs_cb(service, old_state, new_state);
+	}
   	/*
  	 * Return if the reconnection feature is not enabled (all
@@ -687,7 +689,7 @@ static void service_cb(struct btd_service *service,
  	 * be the first profile that's connected so we might have an
  	 * entry but with the reconnect flag set to false.
  	 */
-	if (!reconnect->reconnect)
+	if (!reconnect->reconnect && profile->remote_uuid)
  		reconnect->reconnect = reconnect_match(profile->remote_uuid);
   	DBG("Added %s reconnect %u", profile->name, reconnect->reconnect);
-- 
2.28.0



                 reply	other threads:[~2020-10-16 22:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=b8547b16-60b8-766a-6e63-ae96bead9f0c@tcd.ie \
    --to=omaolaip@tcd.ie \
    --cc=linux-bluetooth@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).